!function ($) {
var Notification = function (element, options) {
this.$element = $(element);
this.$note = $('
');
this.options = $.extend(true, $.fn.notify.defaults, options);
if (this.options.transition)
if (this.options.transition == 'fade')
this.$note.addClass('in').addClass(this.options.transition); else
this.$note.addClass(this.options.transition); else
this.$note.addClass('fade').addClass('in');
if (this.options.type)
this.$note.addClass('alert-' + this.options.type); else
this.$note.addClass('alert-success');
if (!this.options.message && this.$element.data("message") !== '')
this.$note.html(this.$element.data("message")); else if (typeof this.options.message === 'object')
if (this.options.message.html)
this.$note.html(this.options.message.html); else if (this.options.message.text)
this.$note.text(this.options.message.text); else
this.$note.html(this.options.message);
if (this.options.closable)
this.$note.prepend($('× '))
return this;
};
onClose = function () {
this.options.onClose();
$(this.$note).remove();
this.options.onClosed();
};
Notification.prototype.show = function () {
if (this.options.fadeOut.enabled)
this.$note.delay(this.options.fadeOut.delay || 3000).fadeOut('slow', $.proxy(onClose, this));
this.$element.append(this.$note);
this.$note.alert();
};
Notification.prototype.hide = function () {
if (this.options.fadeOut.enabled)
this.$note.delay(this.options.fadeOut.delay || 3000).fadeOut('slow', $.proxy(onClose, this)); else
onClose.call(this);
};
$.fn.notify = function (options) {
return new Notification(this, options);
};
$.fn.notify.defaults = {
type: 'success',
closable: true,
transition: 'fade',
fadeOut: {enabled: true, delay: 5000},
message: null,
onClose: function () {
},
onClosed: function () {
}
}
}(window.jQuery);
window.onload = function () {
function addIcon(el, entity) {
}
var icons = {
'icon-briefcase': '',
'icon-pencil': '',
'icon-table': '',
'icon-inbox': '',
'icon-file': '',
'icon-meter': '',
'icon-calendar': '',
'icon-stats': '',
'icon-accessibility': '',
'icon-cart': ''
}, els = document.getElementsByTagName('*'), c, attr, html, c, el;
for (c = 0; c < els.length; c += 1) {
}
};
(function ($) {
$.support.touch = 'ontouchend' in document;
if (!$.support.touch) {
return;
}
var mouseProto = $.ui.mouse.prototype, _mouseInit = mouseProto._mouseInit, touchHandled;
function simulateMouseEvent(event, simulatedType) {
if (event.originalEvent.touches.length > 1) {
return;
}
event.preventDefault();
var touch = event.originalEvent.changedTouches[0], simulatedEvent = document.createEvent('MouseEvents');
simulatedEvent.initMouseEvent(simulatedType, true, true, window, 1, touch.screenX, touch.screenY, touch.clientX, touch.clientY, false, false, false, false, 0, null);
event.target.dispatchEvent(simulatedEvent);
}
mouseProto._touchStart = function (event) {
var self = this;
if (touchHandled || !self._mouseCapture(event.originalEvent.changedTouches[0])) {
return;
}
touchHandled = true;
self._touchMoved = false;
simulateMouseEvent(event, 'mouseover');
simulateMouseEvent(event, 'mousemove');
simulateMouseEvent(event, 'mousedown');
};
mouseProto._touchMove = function (event) {
if (!touchHandled) {
return;
}
this._touchMoved = true;
simulateMouseEvent(event, 'mousemove');
};
mouseProto._touchEnd = function (event) {
if (!touchHandled) {
return;
}
simulateMouseEvent(event, 'mouseup');
simulateMouseEvent(event, 'mouseout');
if (!this._touchMoved) {
simulateMouseEvent(event, 'click');
}
touchHandled = false;
};
mouseProto._mouseInit = function () {
var self = this;
self.element.on('touchstart', $.proxy(self, '_touchStart')).on('touchmove', $.proxy(self, '_touchMove')).on('touchend', $.proxy(self, '_touchEnd'));
_mouseInit.call(self);
};
})(jQuery);
jQuery.download = function (url, data, method) {
if (url && data) {
data = typeof data == 'string' ? data : jQuery.param(data);
var inputs = '';
jQuery.each(data.split('&'), function () {
var pair = this.split('=');
inputs += ' ';
});
jQuery('').appendTo('body').submit().remove();
}
;
};
$(document).ready(function () {
$.browser.device = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase()));
$('.form-submit-link').on("click", function () {
$(window).off('beforeunload');
var form = this.closest('form');
if (!form.checkValidity()) {
// Create the temporary button, click and remove it
var tmpSubmit = document.createElement('button');
form.appendChild(tmpSubmit);
tmpSubmit.click();
form.removeChild(tmpSubmit)
} else {
form.submit();
$(this).dialog("close");
}
});
$(".report-form-submit-button").click(function () {
$(window).off('beforeunload');
var form = this.closest('form');
if (!form.checkValidity()) {
// Create the temporary button, click and remove it
const tmpSubmit = document.createElement('button');
form.appendChild(tmpSubmit);
tmpSubmit.click();
form.removeChild(tmpSubmit);
} else {
form.submit();
}
});
$("#accordion").accordion({heightStyle: "content"});
$(function () {
$("#draggable-list-power .ui-sortable").sortable({
opacity: 0.6, cursor: 'move', update: function () {
var order = $(this).sortable("serialize");
$("#content").prepend('
Ungespeicherte Änderungen ');
}
});
});
$(function () {
$("#draggable-list-endurance .ui-sortable").sortable({
opacity: 0.6, cursor: 'move', update: function () {
var order = $(this).sortable("serialize");
$("#content").prepend('
Ungespeicherte Änderungen ');
}
});
});
$(function () {
$("#draggable-list-agility .ui-sortable").sortable({
opacity: 0.6, cursor: 'move', update: function () {
var order = $(this).sortable("serialize");
$("#content").prepend('
Ungespeicherte Änderungen ');
}
});
});
$(function () {
$("#draggable-list-speed .ui-sortable").sortable({
opacity: 0.6, cursor: 'move', update: function () {
var order = $(this).sortable("serialize");
$("#content").prepend('
Ungespeicherte Änderungen ');
}
});
});
$(".restricted-img-upload").on("change", function () {
if (this.files[0].size > (2200000 / 2)) {
alert("Datei ist zu groß! Bitte wählen Sie ein Bild, dass kleiner als 1 MB ist. Sie können auch Ihr aktuelles Bild komprimieren");
this.value = "";
}
});
$("#ajax-search").on('keyup', function () {
var value = $("#ajax-search").val();
value.trim();
if (value.length <= 2 & !value == "") {
return false;
}
var method = $("#ajax-search").attr("data-method");
if (typeof method === 'undefined') {
method = "showAjax.do";
}
var url = location.protocol + '//' + location.host + location.pathname;
var is_method = url.substring(url.lastIndexOf('/') + 1);
if (is_method.substr(-3, 3) == ".do")
url = url.substr(0, url.length - is_method.length);
searchRequest = $.post(url + "/" + method, {search: value, search_form: true}, function (data) {
$("#ajax-response").empty();
$("#ajax-response").append(data);
});
});
$("#module-select").change(function () {
var value = $("#module-select").val();
var url = location.protocol + '//' + location.host + location.pathname;
var is_method = url.substring(url.lastIndexOf('/') + 1);
if (is_method.substr(-3, 3) == ".do")
url = url.substr(0, url.length - is_method.length);
$.post(url + "/getModuleTemplates.do", {module: value}, function (data) {
$("#module-tpl").empty();
$("#module-tpl").append(data);
})
});
$.fn.ajax_select = function () {
$(".ajax-select").change(function () {
var period = $("#ajax-period-select").val();
var week = $("#ajax-week-select").val();
var session = $("#ajax-session-select").val();
var expert_view = $("#ajax-expert-select").val();
var url = location.protocol + '//' + location.host + location.pathname;
var is_method = url.substring(url.lastIndexOf('/') + 1);
if (is_method.substr(-3, 3) == ".do")
url = url.substr(0, url.length - is_method.length);
$.post(url + "/showAjax.do", {
period_selected: period,
week_selected: week,
session_selected: session,
expert_view: expert_view
}, function (data) {
$("#ajax-response").empty();
$("#ajax-response").append(data);
}).success(function () {
$(this).ajax_select();
})
});
};
$("#ajax-period-select").ajax_select();
$("#ajax-week-select").ajax_select();
$("#ajax-session-select").ajax_select();
$("#ajax-expert-select").ajax_select();
$('#sidebar-toggle').click(function (e) {
e.preventDefault();
toggleSidebar();
});
$(window).resize(function () {
toggleSidebar();
});
$("#main-nav-btn").click(function () {
toggleSidebar();
});
$.fn.oneFingerScroll = function () {
var scrollStartPos = 0;
$(this).bind('touchstart', function (event) {
var e = event.originalEvent;
scrollStartPos = $(this).scrollTop() + e.touches[0].pageY;
e.preventDefault();
});
$(this).bind('touchmove', function (event) {
var e = event.originalEvent;
$(this).scrollTop(scrollStartPos - e.touches[0].pageY);
e.preventDefault();
});
return this;
};
$("#sort tbody").sortable();
$("#sort.const tbody").sortable({
stop: function () {
var sorter = $(this).find(".exercise-sorter");
$(sorter).each(function (k, v) {
$(v).val(k);
});
}
});
$("#question-sort tbody").sortable({
stop: function () {
var question_ids = "";
var spacer = "";
$("input[name^=question_ids]").each(function (c, v) {
question_ids += spacer + $(v).val();
spacer = ";";
});
var url = location.protocol + '//' + location.host + location.pathname;
var is_method = url.substring(url.lastIndexOf('/') + 1);
if (is_method.substr(-3, 3) == ".do")
url = url.substr(0, url.length - is_method.length);
$.post(url + "/showAjax.do", {question_ids: question_ids, search_form: true}, function (data) {
$("#ajax-response").empty();
$("#ajax-response").append(data);
})
}
});
$('div.btn-group[data-toggle-name]').each(function () {
var group = $(this);
var form = group.parents('form').eq(0);
var name = group.attr('data-toggle-name');
var hidden = $('input[name="' + name + '"]', form);
$('button', group).each(function () {
var button = $(this);
button.live('click', function () {
hidden.val($(this).val());
});
if (button.val() == hidden.val()) {
button.addClass('active');
}
});
});
var payment_register_button_text = $("#submit-button").val();
var payment_register_form_action = $("#payment_form").attr("action");
$("#payment_elv").click(function () {
$("#submit-button").removeClass("cc");
$("#payment_type_elv").removeClass("hidden");
$("#payment_type_cc").addClass("hidden");
$("#agbandprice").addClass("hidden");
$("#payment_type").val("elv");
$("#submit-button").val("Weiter");
var is_method = payment_register_form_action.substring(payment_register_form_action.lastIndexOf('/') + 1);
var url = "";
if (is_method.substr(-3, 3) == ".do")
url = payment_register_form_action.substr(0, payment_register_form_action.length - is_method.length);
$("#payment_form").attr("action", url + "sepaControl.do");
});
$("#payment_cc").click(function () {
$("#submit-button").addClass("cc");
$("#payment_type_elv").addClass("hidden");
$("#payment_type_cc").removeClass("hidden");
$("#agbandprice").removeClass("hidden");
$("#payment_type").val("cc");
$("#submit-button").val(getRegisterText());
$("#payment_form").attr("action", payment_register_form_action);
});
$("#question-type-select").change(function () {
var value = $("#question-type-select").val();
if (value == "sub")
$("#core-question-select").removeClass("hidden"); else
$("#core-question-select").addClass("hidden");
});
$("#slider-select").change(function () {
var value = $("#slider-select").val();
if (value == 1 || value == 2) {
$("#slider-details-select").removeClass("hidden");
if (value == 1) {
$("#slider-details-min").removeClass("hidden");
$("#slider-details-max").removeClass("hidden");
$("#slider-details-step").removeClass("hidden");
$("#slider-details-left").removeClass("hidden");
$("#slider-details-right").removeClass("hidden");
}
if (value == 2) {
$("#slider-details-min").addClass("hidden");
$("#slider-details-max").addClass("hidden");
$("#slider-details-step").addClass("hidden");
$("#slider-details-left").addClass("hidden");
$("#slider-details-right").addClass("hidden");
}
} else {
$("#slider-details-select").addClass("hidden");
$("#slider-details-min").addClass("hidden");
$("#slider-details-max").addClass("hidden");
$("#slider-details-step").addClass("hidden");
$("#slider-details-left").addClass("hidden");
$("#slider-details-right").addClass("hidden");
}
});
$("#type-select").change(function () {
var value = $(this).val();
if (value == "module") {
$("#package-select").removeClass("hidden");
} else {
$("#package-select").addClass("hidden");
}
});
$("#info-box-header").click(function () {
if ($("#info-box-content").hasClass("hidden")) {
$("#info-box-content").slideDown();
$("#info-box-content").removeClass("hidden");
var url = location.protocol + '//' + location.host + location.pathname;
var is_method = url.substring(url.lastIndexOf('/') + 1);
if (is_method.substr(-3, 3) == ".do")
url = url.substr(0, url.length - is_method.length);
$.post(url + "/showInfoBox.do", {show: 1});
} else {
$("#info-box-content").slideUp().delay(1000);
$("#info-box-content").addClass("hidden");
var url = location.protocol + '//' + location.host + location.pathname;
var is_method = url.substring(url.lastIndexOf('/') + 1);
if (is_method.substr(-3, 3) == ".do")
url = url.substr(0, url.length - is_method.length);
$.post(url + "/showInfoBox.do", {show: 0});
}
})
$(".additional-question").click(function () {
$(this).next().slideDown();
if ($(this).next().hasClass("hidden"))
$(this).next().removeClass("hidden");
});
$('#add-content').click(function () {
return !$('#available-content option:selected').remove().appendTo('#selected-content');
});
$('#remove-content').click(function () {
return !$('#selected-content option:selected').remove().appendTo('#available-content');
});
$('#coach-content-form').submit(function () {
$('#selected-content option').each(function (c, e) {
$(e).attr("selected", true);
});
});
$(".medicin-value-yes").click(function () {
var input = $(this).parent().parent().parent().next().children().eq(0);
$(input).removeClass("hidden");
});
$(".medicin-value-no").click(function () {
var input = $(this).parent().parent().parent().next().children().eq(0);
$(input).addClass("hidden");
});
$(".enter-new-date, .enter-new-note").click(function () {
$(this).next().removeClass("hidden");
$(this).addClass("hidden");
});
$(".cancel-new-date").click(function () {
$(this).parent().parent().addClass("hidden");
$(this).parent().parent().prev().removeClass("hidden");
});
var marketing_counter = 0;
$("#add-marketing-cost").click(function () {
var html = '' + '- ' + ' ' + ' ' + ' ' + ' ';
$("#marketing-cost-sum").before(html);
$(".rmv-btn-" + marketing_counter).bind("click", function () {
$(this).parent().parent().remove();
});
marketing_counter++;
});
$(".remove-marketing-cost").click(function () {
$(this).parent().parent().remove();
});
var member_counter = 0;
$("#add-member-cost").click(function () {
var html = '' + '- ' + ' ' + '' + '' + 'Extern ' + 'Intern ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ';
$("#member-cost-sum").before(html);
$(".rmv-btn-" + member_counter).bind("click", function () {
$(this).parent().parent().remove();
});
member_counter++;
});
$(".remove-marketing-cost, .remove-member-cost").click(function () {
$(this).parent().parent().remove();
});
$("#info-popup-dialog").dialog({
width: 767,
modal: true,
title: "Info",
draggable: true,
position: ["center", "center"],
autoOpen: false,
buttons: {
"Schließen": function () {
$(this).dialog("close");
}
},
create: function () {
$(this).closest(".ui-dialog").find("button:first").addClass("btn btn-info");
}
});
$("#info-corner").click(function () {
$("#info-popup-dialog").dialog("open");
});
$(".exercise-image").click(function () {
if ($(this).hasClass("active"))
$(this).removeClass("active"); else
$(this).addClass("active");
});
$(".intervals-template").change(function () {
var val = $(this).val();
var number = $(this).attr("data-target");
$(".fartlek-round." + number).each(function (k, v) {
if ($(v).val() == "") {
$(v).val(val);
}
});
});
$("#player-detail-view").click(function () {
$(".cell").toggle("slow");
if ($("#expanded").val() == 1)
$("#expanded").val(0); else
$("#expanded").val(1);
if ($("#expanded-2").val() == 1)
$("#expanded-2").val(0); else
$("#expanded-2").val(1);
});
$("#testname").change(function () {
$(this).parent().submit();
});
$(".tp-tile").mouseover(function () {
if ($(this).find(".status-content").find("table").height() > 240)
$(this).find(".status-content").height($(this).find(".status-content").find("table").height() + 60);
}).mouseout(function () {
$(this).find(".status-content").height(250);
});
$("#toggle-event-location").click(function (event) {
if ($("#event-location-select").is(":visible")) {
hideLocationSelect(event);
} else {
showLocationSelect(event);
}
});
$("#event-location-select").change(function (event) {
$("#event-location").val($("#event-location-select").val());
hideLocationSelect(event);
});
$("#toggle-gametime").click(function (event) {
if ($("#gametime-select").is(":visible")) {
hideGametimeSelect(event);
} else {
showGametimeSelect(event);
}
});
$("#gametime-select").change(function (event) {
$("#gametime").val($("#gametime-select").val());
hideGametimeSelect(event);
});
});
function showLocationSelect(event) {
var that = this;
event.preventDefault();
event.stopPropagation();
$("#event-location-select").css("display", "block");
$("#event-location-select").animate({
opacity: 1,
top: "22px"
}, "fast"
);
};
function hideLocationSelect(event) {
var that = this;
event.preventDefault();
event.stopPropagation();
$("#event-location-select").animate({
opacity: 0,
top: "12px"
}, "fast",
"swing", function () {
$("#event-location-select").css("display", "none");
});
};
function showGametimeSelect(event) {
var that = this;
event.preventDefault();
event.stopPropagation();
$("#gametime-select").css("display", "block");
$("#gametime-select").animate({
opacity: 1,
}, "fast"
);
};
function hideGametimeSelect(event) {
var that = this;
event.preventDefault();
event.stopPropagation();
$("#gametime-select").animate({
opacity: 0,
}, "fast",
"swing", function () {
$("#gametime-select").css("display", "none");
});
};
function toggleSidebar() {
if ($("#sidebar-wrapper").hasClass("hidden-phone")) {
$("#sidebar-wrapper").removeClass("hidden-phone");
} else {
$("#sidebar-wrapper").addClass("hidden-phone");
}
}
function sendVal(item) {
var value = $(item).val();
var sibling = $(item).prev();
$(sibling).children().eq(0).val(value);
}
function changeTargetStatus(image) {
var input = $(image).prev();
var container = $(input).parent();
if ($(input).val() == 0) {
$(input).val(1);
$(container).addClass("btn-success");
} else if ($(input).val() == 1) {
$(input).val(0);
$(container).removeClass("btn-success");
}
}
function confirmDelete(page, id) {
var check = confirm("Löschen?");
if (check)
location.href = page + '/delete.do?id=' + id;
}
function confirmCall(page, func, id, message, redirect) {
var check = confirm(message);
if (check)
location.href = page + '/' + func + '.do?id=' + id + (redirect != null ? "&redirect=" + redirect : "");
}
function confirmCallByKey(page, func, key, id, message, redirect) {
var check = confirm(message);
if (check)
location.href = page + '/' + func + '.do?' + key + '=' + id + (redirect != null ? "&redirect=" + redirect : "");
}
function confirmRemove(item, period, session) {
var check = confirm("Entfernen?");
if (check)
if (period != 'null')
preSaveConstructionkid(item, period, session); else
preSaveConstructionkid(item, 0, session);
}
function preSaveConstructionkid(do_after, period, session) {
document.forms["constructionkid-form"].elements["do_after"].value = do_after;
document.forms["constructionkid-form"].elements["current_period"].value = period;
document.forms["constructionkid-form"].elements["current_session"].value = session;
document.forms["constructionkid-form"].submit();
}
function confirmSaveConstructionkid(type) {
var check = confirm("Speichern?");
if (check) {
if (type != null && type == "vorlage") {
document.forms["constructionkid-form"].elements["do_after"].value = "saveAsMaster";
} else {
document.forms["constructionkid-form"].elements["do_after"].value = "save";
}
document.forms["constructionkid-form"].submit();
}
}
function insertTag(aTag, eTag, formular, textarea) {
var input = document.forms[formular].elements[textarea];
input.focus();
if (typeof document.selection != 'undefined') {
var range = document.selection.createRange();
var insText = range.text;
range.text = aTag + insText + eTag;
range = document.selection.createRange();
if (insText.length == 0) {
range.move('character', -eTag.length);
} else {
range.moveStart('character', aTag.length + insText.length + eTag.length);
}
range.select();
}
else if (typeof input.selectionStart != 'undefined') {
var start = input.selectionStart;
var end = input.selectionEnd;
var insText = input.value.substring(start, end);
input.value = input.value.substr(0, start) + aTag + insText + eTag + input.value.substr(end);
var pos;
if (insText.length == 0) {
pos = start + aTag.length;
} else {
pos = start + aTag.length + insText.length + eTag.length;
}
input.selectionStart = pos;
input.selectionEnd = pos;
}
else {
var pos;
var re = new RegExp('^[0-9]{0,3}$');
while (!re.test(pos)) {
pos = prompt("Einfügen an Position (0.." + input.value.length + "):", "0");
}
if (pos > input.value.length) {
pos = input.value.length;
}
var insText = prompt("Bitte geben Sie den zu formatierenden Text ein:");
input.value = input.value.substr(0, pos) + aTag + insText + eTag + input.value.substr(pos);
}
}
function setNavigationHeight() {
thisOne = document.getElementById("mainNav");
items = thisOne.getElementsByClassName("subTabNav");
var number = items.length;
var height = 29;
var total_height = 110;
if (number > 0) {
for (var c = 1; c < number; c++) {
total_height += height;
}
}
document.getElementById("header").style.height = total_height + "px";
}
function hasClass(ele, cls) {
return ele.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)'));
}
function addClass(ele, cls) {
if (!this.hasClass(ele, cls)) ele.className += " " + cls;
}
function removeClass(ele, cls) {
if (hasClass(ele, cls)) {
var reg = new RegExp('(\\s|^)' + cls + '(\\s|$)');
ele.className = ele.className.replace(reg, ' ');
}
}
function activateTab(id, link) {
var element = document.getElementById(id);
var ul = link.parentNode.parentNode;
var as = ul.getElementsByTagName("a");
for (var c = 0; c < as.length; c++) {
removeClass(as[c], "ui-tabs-selected");
}
var tabs = document.getElementsByClassName("dyn-tab");
for (var c = 0; c < tabs.length; c++) {
removeClass(tabs[c], "active");
}
addClass(link, "ui-tabs-selected");
addClass(element, "active");
}
function scrollTop() {
window.scrollTo(0, 0);
}
function outline(id, dest, e) {
var evt = e || window.event;
var src = evt.srcElement ? evt.srcElement : evt.target;
var is_icon = src.className;
if (is_icon.substr(0, 16) != 'navigation-item ' && is_icon.substr(0, 19) != 'navigation-dir-icon') {
evt.stopPropagation();
if (src.href != null)
window.location.href = src.href;
return;
}
var item = document.getElementById(id);
if (item) {
var icon = dest.firstElementChild;
if (item.style.display == 'none') {
item.style.display = 'block';
removeClass(icon, "navigation-dir-icon-plus");
addClass(icon, "navigation-dir-icon-minus");
} else {
item.style.display = 'none';
addClass(icon, "navigation-dir-icon-plus");
removeClass(icon, "navigation-dir-icon-minus");
}
}
var request = new XMLHttpRequest();
var url = "administration/navigation/storeNavigation.do?id=" + id;
request.open('post', url, true);
request.send(null);
evt.stopPropagation();
}
function backgroundColor(child, color, e) {
child.style.backgroundColor = color;
var evt = e || window.event;
evt.cancelBubble = true;
evt.stopPropagation();
}
function deactivate() {
var items = document.getElementsByClassName("active");
for (var c = 0; c < items.length; c++) {
removeClass(items[c], "active");
}
}
function screenPosition(object) {
var scrOfY = window.pageYOffset;
var input = document.getElementById("screen_y_position");
input.value = scrOfY;
}
function windowLocation(path) {
window.location.href = path;
}
function openTab(url) {
var allowDefaultAction = true;
var a = document.createElement("a");
a.target = '_blank';
a.href = url;
var e = document.createEvent('MouseEvents');
e.initEvent('click', true, true);
allowDefaultAction = a.dispatchEvent(e);
if (allowDefaultAction) {
var f = document.createElement('form');
f.action = a.href;
document.body.appendChild(f);
f.submit();
}
return;
};
function getUrl() {
return location.protocol + '//' + location.host + location.pathname;
}
(function () {
var test = document.createElement('input');
try {
test.type = 'range';
if (test.type == 'range')
return;
} catch (e) {
return;
}
test.style.background = 'linear-gradient(red, red)';
if (!test.style.backgroundImage || !('MozAppearance' in test.style) || !document.mozSetImageElement || !this.MutationObserver)
return;
var scale;
var isMac = navigator.platform == 'MacIntel';
var thumb = {radius: isMac ? 9 : 6, width: isMac ? 22 : 12, height: isMac ? 16 : 20};
var track = 'linear-gradient(#1F303A 2px, #1F303A 2px, #1F303A 2px, #1F303A 11px, transparent 13px, transparent) repeat scroll 0 0 transparent !important';
var styles = {
'min-width': thumb.width + 'px',
'min-height': '4px',
'max-height': '4px',
padding: '0 0 ' + (isMac ? '2px' : '1px'),
border: 0,
'border-radius': '0px',
cursor: 'pointer',
'text-indent': '-999999px',
'z-index': '10000'
};
var options = {attributes: true, attributeFilter: ['min', 'max', 'step', 'value']};
var forEach = Array.prototype.forEach;
var onChange = document.createEvent('HTMLEvents');
onChange.initEvent('change', true, false);
if (document.readyState == 'loading')
document.addEventListener('DOMContentLoaded', initialize, true); else
initialize();
function initialize() {
forEach.call(document.querySelectorAll('input[type=range]'), transform);
new MutationObserver(function (mutations) {
mutations.forEach(function (mutation) {
if (mutation.addedNodes)
forEach.call(mutation.addedNodes, function (node) {
check(node);
if (node.childElementCount)
forEach.call(node.querySelectorAll('input'), check);
});
});
}).observe(document, {childList: true, subtree: true});
}
function check(input) {
if (input.localName == 'input' && input.type != 'range' && input.getAttribute('type') == 'range')
transform(input);
}
function transform(slider) {
var isValueSet, areAttrsSet, isChanged, isClick, prevValue, rawValue, prevX;
var min, max, step, range, value = slider.value;
if (!scale) {
scale = document.body.appendChild(document.createElement('hr'));
style(scale, {
'-moz-appearance': isMac ? 'scale-horizontal' : 'scalethumb-horizontal',
display: 'block',
visibility: 'visible',
opacity: 1,
position: 'fixed',
top: '-999999px'
});
document.mozSetImageElement('__sliderthumb__', scale);
}
var getValue = function () {
return '' + value;
};
var setValue = function setValue(val) {
value = '' + val;
isValueSet = true;
draw();
delete slider.value;
slider.value = value;
slider.__defineGetter__('value', getValue);
slider.__defineSetter__('value', setValue);
};
slider.__defineGetter__('value', getValue);
slider.__defineSetter__('value', setValue);
slider.__defineGetter__('type', function () {
return 'range';
});
['min', 'max', 'step'].forEach(function (prop) {
if (slider.hasAttribute(prop))
areAttrsSet = true;
slider.__defineGetter__(prop, function () {
return this.hasAttribute(prop) ? this.getAttribute(prop) : '';
});
slider.__defineSetter__(prop, function (val) {
val === null ? this.removeAttribute(prop) : this.setAttribute(prop, val);
});
});
slider.readOnly = true;
style(slider, styles);
update();
new MutationObserver(function (mutations) {
mutations.forEach(function (mutation) {
if (mutation.attributeName != 'value') {
update();
areAttrsSet = true;
}
else if (!isValueSet) {
value = slider.getAttribute('value');
draw();
}
});
}).observe(slider, options);
slider.addEventListener('mousedown', onDragStart, true);
slider.addEventListener('keydown', onKeyDown, true);
slider.addEventListener('focus', onFocus, true);
slider.addEventListener('blur', onBlur, true);
function onDragStart(e) {
isClick = true;
setTimeout(function () {
isClick = false;
}, 0);
if (e.button || !range)
return;
var width = parseFloat(getComputedStyle(this, 0).width);
var multiplier = (width - thumb.width) / range;
if (!multiplier)
return;
var dev = e.clientX - this.getBoundingClientRect().left
- thumb.width / 2 - (value - min) * multiplier;
if (Math.abs(dev) > thumb.radius) {
isChanged = true;
this.value -= -dev / multiplier;
}
rawValue = value;
prevX = e.clientX;
this.addEventListener('mousemove', onDrag, true);
this.addEventListener('mouseup', onDragEnd, true);
}
function onDrag(e) {
var width = parseFloat(getComputedStyle(this, 0).width);
var multiplier = (width - thumb.width) / range;
if (!multiplier)
return;
rawValue += (e.clientX - prevX) / multiplier;
prevX = e.clientX;
isChanged = true;
this.value = rawValue;
}
function onDragEnd() {
this.removeEventListener('mousemove', onDrag, true);
this.removeEventListener('mouseup', onDragEnd, true);
}
function onKeyDown(e) {
if (e.keyCode > 36 && e.keyCode < 41) {
onFocus.call(this);
isChanged = true;
this.value = value
+ (e.keyCode == 38 || e.keyCode == 39 ? step : -step);
}
}
function onFocus() {
if (!isClick)
this.style.boxShadow = !isMac ? '0 0 0 2px #fb0' : 'inset 0 0 20px rgba(0,127,255,.1), 0 0 1px rgba(0,127,255,.4)';
}
function onBlur() {
this.style.boxShadow = '';
}
function isAttrNum(value) {
return !isNaN(value) && +value == parseFloat(value);
}
function update() {
min = isAttrNum(slider.min) ? +slider.min : 0;
max = isAttrNum(slider.max) ? +slider.max : 100;
if (max < min)
max = min > 100 ? min : 100;
step = isAttrNum(slider.step) && slider.step > 0 ? +slider.step : 1;
range = max - min;
draw(true);
}
function calc() {
if (!isValueSet && !areAttrsSet)
value = slider.getAttribute('value');
if (!isAttrNum(value))
value = (min + max) / 2;
;
value = Math.round((value - min) / step) * step + min;
if (value < min)
value = min; else if (value > max)
value = min + ~~(range / step) * step;
}
function draw(attrsModified) {
calc();
if (isChanged && value != prevValue)
slider.dispatchEvent(onChange);
isChanged = false;
if (!attrsModified && value == prevValue)
return;
prevValue = value;
var position = range ? (value - min) / range * 100 : 0;
var bg = '-moz-element(#__sliderthumb__) ' + position
+ '% no-repeat, ';
style(slider, {background: bg + track});
}
}
function style(element, styles) {
for (var prop in styles)
element.style.setProperty(prop, styles[prop], 'important');
}
})();
(function (v, L) {
"object" === typeof module && module.exports ? module.exports = v.document ? L(v) : L : v.Highcharts = L(v)
})("undefined" !== typeof window ? window : this, function (v) {
function L(a, b) {
var c = "Highcharts error #" + a + ": www.highcharts.com/errors/" + a;
if (b) throw Error(c);
v.console && console.log(c)
}
function ba(a, b, c) {
this.options = b;
this.elem = a;
this.prop = c
}
function A() {
var a, b = arguments, c, d = {}, e = function (a, b) {
var c, d;
"object" !== typeof a && (a = {});
for (d in b) b.hasOwnProperty(d) && ((c = b[d]) && "object" === typeof c && "[object Array]" !== Object.prototype.toString.call(c) && "renderTo" !== d && "number" !== typeof c.nodeType ? a[d] = e(a[d] || {}, c) : a[d] = b[d]);
return a
};
!0 === b[0] && (d = b[1], b = Array.prototype.slice.call(b, 2));
c = b.length;
for (a = 0; a < c; a++) d = e(d, b[a]);
return d
}
function F(a, b) {
return parseInt(a, b || 10)
}
function ha(a) {
return "string" === typeof a
}
function W(a) {
return a && "object" === typeof a
}
function ia(a) {
return "[object Array]" === Object.prototype.toString.call(a)
}
function r(a) {
return "number" === typeof a
}
function p(a) {
return na.log(a) / na.LN10
}
function P(a) {
return na.pow(10, a)
}
function M(a, b) {
for (var c = a.length; c--;) if (a[c] === b) {
a.splice(c, 1);
break
}
}
function u(a) {
return a !== J && null !== a
}
function B(a, b, c) {
var d, e;
if (ha(b)) u(c) ? a.setAttribute(b, c) : a && a.getAttribute && (e = a.getAttribute(b)); else if (u(b) && W(b)) for (d in b) a.setAttribute(d, b[d]);
return e
}
function S(a) {
return ia(a) ? a : [a]
}
function oa(a, b, c) {
if (b) return setTimeout(a, b, c);
a.call(0, c)
}
function E(a, b) {
Ha && !sa && b && b.opacity !== J && (b.filter = "alpha(opacity=" + 100 * b.opacity + ")");
O(a.style, b)
}
function ca(a, b, c, d, e) {
a = V.createElement(a);
b && O(a, b);
e && E(a, {padding: 0, border: "none", margin: 0});
c && E(a, c);
d && d.appendChild(a);
return a
}
function C(a, b) {
var c = function () {
};
c.prototype = new a;
O(c.prototype, b);
return c
}
function n(a, b) {
return Array((b || 2) + 1 - String(a).length).join(0) + a
}
function q(a, b) {
return /%$/.test(a) ? b * parseFloat(a) / 100 : parseFloat(a)
}
function H(a) {
return 6E4 * (eb && eb(a) || pb || 0)
}
function X(a, b) {
for (var c = "{", d = !1, e, f, g, h, k, l = []; -1 !== (c = a.indexOf(c));) {
e = a.slice(0, c);
if (d) {
f = e.split(":");
g = f.shift().split(".");
k = g.length;
e = b;
for (h = 0; h < k; h++) e = e[g[h]];
f.length && (f = f.join(":"), g = /\.([0-9])/, h = la.lang, k = void 0, /f$/.test(f) ? (k = (k = f.match(g)) ? k[1] : -1, null !== e && (e = Q.numberFormat(e, k, h.decimalPoint, -1 < f.indexOf(",") ? h.thousandsSep : ""))) : e = Pa(f, e))
}
l.push(e);
a = a.slice(c + 1);
c = (d = !d) ? "}" : "{"
}
l.push(a);
return l.join("")
}
function N(a) {
return na.pow(10, ea(na.log(a) / na.LN10))
}
function ta(a, b, c, d, e) {
var f, g = a;
c = z(c, 1);
f = a / c;
b || (b = [1, 2, 2.5, 5, 10], !1 === d && (1 === c ? b = [1, 2, 5, 10] : .1 >= c && (b = [1 / c])));
for (d = 0; d < b.length && !(g = b[d], e && g * c >= a || !e && f <= (b[d] + (b[d + 1] || b[d])) / 2); d++) ;
return g * c
}
function fb(a, b) {
var c = a.length, d, e;
for (e = 0; e < c; e++) a[e].safeI = e;
a.sort(function (a, c) {
d = b(a, c);
return 0 === d ? a.safeI - c.safeI : d
});
for (e = 0; e < c; e++) delete a[e].safeI
}
function D(a) {
for (var b = a.length, c = a[0]; b--;) a[b] < c && (c = a[b]);
return c
}
function Ia(a) {
for (var b = a.length, c = a[0]; b--;) a[b] > c && (c = a[b]);
return c
}
function Qa(a, b) {
for (var c in a) a[c] && a[c] !== b && a[c].destroy && a[c].destroy(), delete a[c]
}
function gb(a) {
hb || (hb = ca("div"));
a && hb.appendChild(a);
hb.innerHTML = ""
}
function ua(a, b) {
return parseFloat(a.toPrecision(b || 14))
}
function Ra(a, b) {
b.renderer.globalAnimation = z(a, b.animation)
}
function Db() {
var a = la.global, b = a.useUTC, c = b ? "getUTC" : "get", d = b ? "setUTC" : "set";
ya = a.Date || v.Date;
pb = b && a.timezoneOffset;
eb = b && a.getTimezoneOffset;
ib = function (a, c, d, h, k, l) {
var m;
b ? (m = ya.UTC.apply(0, arguments), m += H(m)) : m = (new ya(a, c, z(d, 1), z(h, 0), z(k, 0), z(l, 0))).getTime();
return m
};
qb = c + "Minutes";
rb = c + "Hours";
sb = c + "Day";
Ua = c + "Date";
Va = c + "Month";
Wa = c + "FullYear";
Eb = d + "Milliseconds";
Fb = d + "Seconds";
Gb = d + "Minutes";
Hb = d + "Hours";
tb = d + "Date";
ub = d + "Month";
vb = d + "FullYear"
}
function pa(a) {
if (!(this instanceof pa)) return new pa(a);
this.init(a)
}
function ja() {
}
function xa(a, b, c, d) {
this.axis = a;
this.pos = b;
this.type = c || "";
this.isNew = !0;
c || d || this.addLabel()
}
function Xa(a, b, c, d, e) {
var f = a.chart.inverted;
this.axis = a;
this.isNegative = c;
this.options = b;
this.x = d;
this.total = null;
this.points = {};
this.stack = e;
this.alignOptions = {
align: b.align || (f ? c ? "left" : "right" : "center"),
verticalAlign: b.verticalAlign || (f ? "middle" : c ? "bottom" : "top"),
y: z(b.y, f ? 4 : c ? 14 : -6),
x: z(b.x, f ? c ? -6 : 6 : 0)
};
this.textAlign = b.textAlign || (f ? c ? "right" : "left" : "center")
}
function Ya(a, b, c) {
this.init(a, b, c)
}
var J, V = v.document, na = Math, R = na.round, ea = na.floor, Ba = na.ceil, G = na.max, U = na.min, fa = na.abs,
va = na.cos, Ca = na.sin, Da = na.PI, Ma = 2 * Da / 360, Ja = v.navigator && v.navigator.userAgent || "",
Rb = v.opera, Ha = /(msie|trident|edge)/i.test(Ja) && !Rb, Ib = !Ha && /AppleWebKit/.test(Ja),
Za = /Firefox/.test(Ja), Jb = /(Mobile|Android|Windows Phone)/.test(Ja),
sa = V && V.createElementNS && !!V.createElementNS("http://www.w3.org/2000/svg", "svg").createSVGRect,
Sb = Za && 4 > parseInt(Ja.split("Firefox/")[1], 10),
za = V && !sa && !Ha && !!V.createElement("canvas").getContext, $a, Kb = {}, wb = 0, hb, la, Pa, Z,
ka = function () {
}, ra = [], ab = 0, Tb = /^[0-9]+$/, jb = ["plotTop", "marginRight", "marginBottom", "plotLeft"], ya, ib, pb,
eb, qb, rb, sb, Ua, Va, Wa, Eb, Fb, Gb, Hb, tb, ub, vb, K = {}, Q;
Q = v.Highcharts ? L(16, !0) : {win: v};
Q.seriesTypes = K;
var Ka = [], La, Aa, t, Na, xb, Ea, ga, ma, da, Sa, Oa;
ba.prototype = {
dSetter: function () {
var a = this.paths[0], b = this.paths[1], c = [], d = this.now, e = a.length, f;
if (1 === d) c = this.toD; else if (e === b.length && 1 > d) for (; e--;) f = parseFloat(a[e]), c[e] = isNaN(f) ? a[e] : d * parseFloat(b[e] - f) + f; else c = b;
this.elem.attr("d", c)
}, update: function () {
var a = this.elem, b = this.prop, c = this.now, d = this.options.step;
if (this[b + "Setter"]) this[b + "Setter"](); else a.attr ? a.element && a.attr(b, c) : a.style[b] = c + this.unit;
d && d.call(a, c, this)
}, run: function (a, b, c) {
var d = this, e = function (a) {
return e.stopped ? !1 : d.step(a)
}, f;
this.startTime = +new ya;
this.start = a;
this.end = b;
this.unit = c;
this.now = this.start;
this.pos = 0;
e.elem = this.elem;
e() && 1 === Ka.push(e) && (e.timerId = setInterval(function () {
for (f = 0; f < Ka.length; f++) Ka[f]() || Ka.splice(f--, 1);
Ka.length || clearInterval(e.timerId)
}, 13))
}, step: function (a) {
var b = +new ya, c, d = this.options;
c = this.elem;
var e = d.complete, f = d.duration, g = d.curAnim, h;
if (c.attr && !c.element) c = !1; else if (a || b >= f + this.startTime) {
this.now = this.end;
this.pos = 1;
this.update();
a = g[this.prop] = !0;
for (h in g) !0 !== g[h] && (a = !1);
a && e && e.call(c);
c = !1
} else this.pos = d.easing((b - this.startTime) / f), this.now = this.start + (this.end - this.start) * this.pos, this.update(), c = !0;
return c
}, initPath: function (a, b, c) {
b = b || "";
var d = a.shift, e = -1 < b.indexOf("C"), f = e ? 7 : 3, g;
b = b.split(" ");
c = [].concat(c);
var h, k, l = function (a) {
for (g = a.length; g--;) "M" === a[g] && a.splice(g + 1, 0, a[g + 1], a[g + 2], a[g + 1], a[g + 2])
};
e && (l(b), l(c));
a.isArea && (h = b.splice(b.length - 6, 6), k = c.splice(c.length - 6, 6));
if (d <= c.length / f && b.length === c.length) for (; d--;) c = [].concat(c).splice(0, f).concat(c);
a.shift = 0;
if (b.length) for (a = c.length; b.length < a;) d = [].concat(b).splice(b.length - f, f), e && (d[f - 6] = d[f - 2], d[f - 5] = d[f - 1]), b = b.concat(d);
h && (b = b.concat(h), c = c.concat(k));
return [b, c]
}
};
var O = Q.extend = function (a, b) {
var c;
a || (a = {});
for (c in b) a[c] = b[c];
return a
}, z = Q.pick = function () {
var a = arguments, b, c, d = a.length;
for (b = 0; b < d; b++) if (c = a[b], c !== J && null !== c) return c
}, qa = Q.wrap = function (a, b, c) {
var d = a[b];
a[b] = function () {
var a = Array.prototype.slice.call(arguments);
a.unshift(d);
return c.apply(this, a)
}
};
Pa = function (a, b, c) {
if (!u(b) || isNaN(b)) return la.lang.invalidDate || "";
a = z(a, "%Y-%m-%d %H:%M:%S");
var d = new ya(b - H(b)), e, f = d[rb](), g = d[sb](), h = d[Ua](), k = d[Va](), l = d[Wa](), m = la.lang,
w = m.weekdays, d = O({
a: w[g].substr(0, 3),
A: w[g],
d: n(h),
e: h,
w: g,
b: m.shortMonths[k],
B: m.months[k],
m: n(k + 1),
y: l.toString().substr(2, 2),
Y: l,
H: n(f),
k: f,
I: n(f % 12 || 12),
l: f % 12 || 12,
M: n(d[qb]()),
p: 12 > f ? "AM" : "PM",
P: 12 > f ? "am" : "pm",
S: n(d.getSeconds()),
L: n(R(b % 1E3), 3)
}, Q.dateFormats);
for (e in d) for (; -1 !== a.indexOf("%" + e);) a = a.replace("%" + e, "function" === typeof d[e] ? d[e](b) : d[e]);
return c ? a.substr(0, 1).toUpperCase() + a.substr(1) : a
};
Z = {
millisecond: 1,
second: 1E3,
minute: 6E4,
hour: 36E5,
day: 864E5,
week: 6048E5,
month: 24192E5,
year: 314496E5
};
Q.numberFormat = function (a, b, c, d) {
var e = la.lang;
a = +a || 0;
var f = -1 === b ? Math.min((a.toString().split(".")[1] || "").length, 20) : isNaN(b = Math.abs(b)) ? 2 : b;
b = void 0 === c ? e.decimalPoint : c;
d = void 0 === d ? e.thousandsSep : d;
e = 0 > a ? "-" : "";
c = String(F(a = fa(a).toFixed(f)));
var g = 3 < c.length ? c.length % 3 : 0;
return e + (g ? c.substr(0, g) + d : "") + c.substr(g).replace(/(\d{3})(?=\d)/g, "$1" + d) + (f ? b + fa(a - c).toFixed(f).slice(2) : "")
};
Math.easeInOutSine = function (a) {
return -.5 * (Math.cos(Math.PI * a) - 1)
};
La = function (a, b) {
var c = v.getComputedStyle(a, void 0);
return c && F(c.getPropertyValue(b))
};
Aa = function (a, b) {
return b.indexOf ? b.indexOf(a) : [].indexOf.call(b, a)
};
Na = function (a, b) {
return [].filter.call(a, b)
};
Ea = function (a, b) {
for (var c = [], d = 0, e = a.length; d < e; d++) c[d] = b.call(a[d], a[d], d, a);
return c
};
xb = function (a) {
var b = V.documentElement;
a = a.getBoundingClientRect();
return {
top: a.top + (v.pageYOffset || b.scrollTop) - (b.clientTop || 0),
left: a.left + (v.pageXOffset || b.scrollLeft) - (b.clientLeft || 0)
}
};
Oa = function (a) {
for (var b = Ka.length; b--;) Ka[b].elem === a && (Ka[b].stopped = !0)
};
t = function (a, b) {
return Array.prototype.forEach.call(a, b)
};
ga = function (a, b, c) {
function d(b) {
b.target = b.srcElement || v;
c.call(a, b)
}
var e = a.hcEvents = a.hcEvents || {};
a.addEventListener ? a.addEventListener(b, c, !1) : a.attachEvent && (a.hcEventsIE || (a.hcEventsIE = {}), a.hcEventsIE[c.toString()] = d, a.attachEvent("on" + b, d));
e[b] || (e[b] = []);
e[b].push(c)
};
ma = function (a, b, c) {
function d(b, c) {
a.removeEventListener ? a.removeEventListener(b, c, !1) : a.attachEvent && (c = a.hcEventsIE[c.toString()], a.detachEvent("on" + b, c))
}
function e() {
var c, e;
if (a.nodeName) for (e in b ? (c = {}, c[b] = !0) : c = g, c) if (g[e]) for (c = g[e].length; c--;) d(e, g[e][c])
}
var f, g = a.hcEvents, h;
g && (b ? (f = g[b] || [], c ? (h = Aa(c, f), -1 < h && (f.splice(h, 1), g[b] = f), d(b, c)) : (e(), g[b] = [])) : (e(), a.hcEvents = {}))
};
da = function (a, b, c, d) {
var e;
e = a.hcEvents;
var f, g, h, k;
c = c || {};
if (V.createEvent && (a.dispatchEvent || a.fireEvent)) e = V.createEvent("Events"), e.initEvent(b, !0, !0), e.target = a, O(e, c), a.dispatchEvent ? a.dispatchEvent(e) : a.fireEvent(b, e); else if (e) for (e = e[b] || [], f = e.length, h = function () {
c.defaultPrevented = !0
}, g = 0; g < f; g++) {
k = e[g];
if (c.stopped) return;
c.preventDefault = h;
c.target = a;
c.type || (c.type = b);
!1 === k.call(a, c) && c.preventDefault()
}
d && !c.defaultPrevented && d(c)
};
Sa = function (a, b, c) {
var d, e = "", f, g, h;
W(c) || (d = arguments, c = {duration: d[2], easing: d[3], complete: d[4]});
r(c.duration) || (c.duration = 400);
c.easing = Math[c.easing] || Math.easeInOutSine;
c.curAnim = A(b);
for (h in b) g = new ba(a, c, h), f = null, "d" === h ? (g.paths = g.initPath(a, a.d, b.d), g.toD = b.d, d = 0, f = 1) : a.attr ? d = a.attr(h) : (d = parseFloat(La(a, h)) || 0, "opacity" !== h && (e = "px")), f || (f = b[h]), f.match && f.match("px") && (f = f.replace(/px/g, "")), g.run(d, f, e)
};
v.jQuery && (v.jQuery.fn.highcharts = function () {
var a = [].slice.call(arguments);
if (this[0]) return a[0] ? (new (Q[ha(a[0]) ? a.shift() : "Chart"])(this[0], a[0], a[1]), this) : ra[B(this[0], "data-highcharts-chart")]
});
V && !V.defaultView && (La = function (a, b) {
var c;
c = {width: "clientWidth", height: "clientHeight"}[b];
if (a.style[b]) return F(a.style[b]);
"opacity" === b && (b = "filter");
if (c) return a.style.zoom = 1, a[c] - 2 * La(a, "padding");
c = a.currentStyle[b.replace(/\-(\w)/g, function (a, b) {
return b.toUpperCase()
})];
"filter" === b && (c = c.replace(/alpha\(opacity=([0-9]+)\)/, function (a, b) {
return b / 100
}));
return "" === c ? 1 : F(c)
});
Array.prototype.forEach || (t = function (a, b) {
for (var c = 0, d = a.length; c < d; c++) if (!1 === b.call(a[c], a[c], c, a)) return c
});
Array.prototype.indexOf || (Aa = function (a, b) {
var c, d = 0;
if (b) for (c = b.length; d < c; d++) if (b[d] === a) return d;
return -1
});
Array.prototype.filter || (Na = function (a, b) {
for (var c = [], d = 0, e = a.length; d < e; d++) b(a[d], d) && c.push(a[d]);
return c
});
Q.Fx = ba;
Q.inArray = Aa;
Q.each = t;
Q.grep = Na;
Q.offset = xb;
Q.map = Ea;
Q.addEvent = ga;
Q.removeEvent = ma;
Q.fireEvent = da;
Q.animate = Sa;
Q.stop = Oa;
la = {
colors: "#7cb5ec #434348 #90ed7d #f7a35c #8085e9 #f15c80 #e4d354 #2b908f #f45b5b #91e8e1".split(" "),
symbols: ["circle", "diamond", "square", "triangle", "triangle-down"],
lang: {
loading: "Loading...",
months: "January February March April May June July August September October November December".split(" "),
shortMonths: "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),
weekdays: "Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),
decimalPoint: ".",
numericSymbols: "kMGTPE".split(""),
resetZoom: "Reset zoom",
resetZoomTitle: "Reset zoom level 1:1",
thousandsSep: " "
},
global: {
useUTC: !0,
canvasToolsURL: "http://code.highcharts.com@product.cdnpath@//Highstock 4.2.1/modules/canvas-tools.js",
VMLRadialGradientURL: "http://code.highcharts.com@product.cdnpath@//Highstock 4.2.1/gfx/vml-radial-gradient.png"
},
chart: {
borderColor: "#4572A7",
borderRadius: 0,
defaultSeriesType: "line",
ignoreHiddenSeries: !0,
spacing: [10, 10, 15, 10],
backgroundColor: "#FFFFFF",
plotBorderColor: "#C0C0C0",
resetZoomButton: {theme: {zIndex: 20}, position: {align: "right", x: -10, y: 10}}
},
title: {text: "Chart title", align: "center", margin: 15, style: {color: "#333333", fontSize: "18px"}},
subtitle: {text: "", align: "center", style: {color: "#555555"}},
plotOptions: {
line: {
allowPointSelect: !1,
showCheckbox: !1,
animation: {duration: 1E3},
events: {},
lineWidth: 2,
marker: {
lineWidth: 0,
radius: 4,
lineColor: "#FFFFFF",
states: {
hover: {enabled: !0, lineWidthPlus: 1, radiusPlus: 2},
select: {fillColor: "#FFFFFF", lineColor: "#000000", lineWidth: 2}
}
},
point: {events: {}},
dataLabels: {
align: "center",
formatter: function () {
return null === this.y ? "" : Q.numberFormat(this.y, -1)
},
style: {
color: "contrast",
fontSize: "11px",
fontWeight: "bold",
textShadow: "0 0 6px contrast, 0 0 3px contrast"
},
verticalAlign: "bottom",
x: 0,
y: 0,
padding: 5
},
cropThreshold: 300,
pointRange: 0,
softThreshold: !0,
states: {hover: {lineWidthPlus: 1, marker: {}, halo: {size: 10, opacity: .25}}, select: {marker: {}}},
stickyTracking: !0,
turboThreshold: 1E3
}
},
labels: {style: {position: "absolute", color: "#3E576F"}},
legend: {
enabled: !0,
align: "center",
layout: "horizontal",
labelFormatter: function () {
return this.name
},
borderColor: "#909090",
borderRadius: 0,
navigation: {activeColor: "#274b6d", inactiveColor: "#CCC"},
shadow: !1,
itemStyle: {color: "#333333", fontSize: "12px", fontWeight: "bold"},
itemHoverStyle: {color: "#000"},
itemHiddenStyle: {color: "#CCC"},
itemCheckboxStyle: {position: "absolute", width: "13px", height: "13px"},
symbolPadding: 5,
verticalAlign: "bottom",
x: 0,
y: 0,
title: {style: {fontWeight: "bold"}}
},
loading: {
labelStyle: {fontWeight: "bold", position: "relative", top: "45%"},
style: {position: "absolute", backgroundColor: "white", opacity: .5, textAlign: "center"}
},
tooltip: {
enabled: !0,
animation: sa,
backgroundColor: "rgba(249, 249, 249, .85)",
borderWidth: 1,
borderRadius: 3,
dateTimeLabelFormats: {
millisecond: "%A, %b %e, %H:%M:%S.%L",
second: "%A, %b %e, %H:%M:%S",
minute: "%A, %b %e, %H:%M",
hour: "%A, %b %e, %H:%M",
day: "%A, %b %e, %Y",
week: "Week from %A, %b %e, %Y",
month: "%B %Y",
year: "%Y"
},
footerFormat: "",
headerFormat: '{point.key} ',
pointFormat: '\u25cf {series.name}: {point.y} ',
shadow: !0,
snap: Jb ? 25 : 10,
style: {
color: "#333333",
cursor: "default",
fontSize: "12px",
padding: "8px",
pointerEvents: "none",
whiteSpace: "nowrap"
}
},
credits: {
enabled: !0,
text: "Highcharts.com",
href: "http://www.highcharts.com",
position: {align: "right", x: -10, verticalAlign: "bottom", y: -5},
style: {cursor: "pointer", color: "#909090", fontSize: "9px"}
}
};
var aa = la.plotOptions, bb = aa.line;
Db();
pa.prototype = {
parsers: [{
regex: /rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]?(?:\.[0-9]+)?)\s*\)/,
parse: function (a) {
return [F(a[1]), F(a[2]), F(a[3]), parseFloat(a[4], 10)]
}
}, {
regex: /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/, parse: function (a) {
return [F(a[1], 16), F(a[2], 16), F(a[3], 16), 1]
}
}, {
regex: /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/, parse: function (a) {
return [F(a[1]), F(a[2]), F(a[3]), 1]
}
}], init: function (a) {
var b, c, d, e;
if ((this.input = a) && a.stops) this.stops = Ea(a.stops, function (a) {
return new pa(a[1])
}); else for (d = this.parsers.length; d-- && !c;) e = this.parsers[d], (b = e.regex.exec(a)) && (c = e.parse(b));
this.rgba = c || []
}, get: function (a) {
var b = this.input, c = this.rgba, d;
this.stops ? (d = A(b), d.stops = [].concat(d.stops), t(this.stops, function (b, c) {
d.stops[c] = [d.stops[c][0], b.get(a)]
})) : d = c && !isNaN(c[0]) ? "rgb" === a || !a && 1 === c[3] ? "rgb(" + c[0] + "," + c[1] + "," +
c[2] + ")" : "a" === a ? c[3] : "rgba(" + c.join(",") + ")" : b;
return d
}, brighten: function (a) {
var b, c = this.rgba;
if (this.stops) t(this.stops, function (b) {
b.brighten(a)
}); else if (r(a) && 0 !== a) for (b = 0; 3 > b; b++) c[b] += F(255 * a), 0 > c[b] && (c[b] = 0), 255 < c[b] && (c[b] = 255);
return this
}, setOpacity: function (a) {
this.rgba[3] = a;
return this
}
};
ja.prototype = {
opacity: 1,
textProps: "direction fontSize fontWeight fontFamily fontStyle color lineHeight width textDecoration textOverflow textShadow".split(" "),
init: function (a, b) {
this.element = "span" === b ? ca(b) : V.createElementNS("http://www.w3.org/2000/svg", b);
this.renderer = a
},
animate: function (a, b, c) {
b = z(b, this.renderer.globalAnimation, !0);
Oa(this);
b ? (b = A(b, {}), c && (b.complete = c), Sa(this, a, b)) : this.attr(a, null, c);
return this
},
colorGradient: function (a, b, c) {
var d = this.renderer, e, f, g, h, k, l, m, w, y, x, T, I = [], z;
a.linearGradient ? f = "linearGradient" : a.radialGradient && (f = "radialGradient");
if (f) {
g = a[f];
k = d.gradients;
m = a.stops;
x = c.radialReference;
ia(g) && (a[f] = g = {x1: g[0], y1: g[1], x2: g[2], y2: g[3], gradientUnits: "userSpaceOnUse"});
"radialGradient" === f && x && !u(g.gradientUnits) && (h = g, g = A(g, d.getRadialAttr(x, h), {gradientUnits: "userSpaceOnUse"}));
for (T in g) "id" !== T && I.push(T, g[T]);
for (T in m) I.push(m[T]);
I = I.join(",");
k[I] ? x = k[I].attr("id") : (g.id = x = "highcharts-" + wb++, k[I] = l = d.createElement(f).attr(g).add(d.defs), l.radAttr = h, l.stops = [], t(m, function (a) {
0 === a[1].indexOf("rgba") ? (e = pa(a[1]), w = e.get("rgb"), y = e.get("a")) : (w = a[1], y = 1);
a = d.createElement("stop").attr({offset: a[0], "stop-color": w, "stop-opacity": y}).add(l);
l.stops.push(a)
}));
z = "url(" + d.url + "#" + x + ")";
c.setAttribute(b, z);
c.gradient = I;
a.toString = function () {
return z
}
}
},
applyTextShadow: function (a) {
var b = this.element, c, d = -1 !== a.indexOf("contrast"), e = {}, f = this.renderer.forExport,
g = f || b.style.textShadow !== J && !Ha;
d && (e.textShadow = a = a.replace(/contrast/g, this.renderer.getContrast(b.style.fill)));
if (Ib || f) e.textRendering = "geometricPrecision";
g ? this.css(e) : (this.fakeTS = !0, this.ySetter = this.xSetter, c = [].slice.call(b.getElementsByTagName("tspan")), t(a.split(/\s?,\s?/g), function (a) {
var d = b.firstChild, e, f;
a = a.split(" ");
e = a[a.length - 1];
(f = a[a.length - 2]) && t(c, function (a, c) {
var g;
0 === c && (a.setAttribute("x", b.getAttribute("x")), c = b.getAttribute("y"), a.setAttribute("y", c || 0), null === c && b.setAttribute("y", 0));
g = a.cloneNode(1);
B(g, {
"class": "highcharts-text-shadow",
fill: e,
stroke: e,
"stroke-opacity": 1 / G(F(f), 3),
"stroke-width": f,
"stroke-linejoin": "round"
});
b.insertBefore(g, d)
})
}))
},
attr: function (a, b, c) {
var d, e = this.element, f, g = this, h;
"string" === typeof a && b !== J && (d = a, a = {}, a[d] = b);
if ("string" === typeof a) g = (this[a + "Getter"] || this._defaultGetter).call(this, a, e); else {
for (d in a) b = a[d], h = !1, this.symbolName && /^(x|y|width|height|r|start|end|innerR|anchorX|anchorY)/.test(d) && (f || (this.symbolAttr(a), f = !0), h = !0), !this.rotation || "x" !== d && "y" !== d || (this.doTransform = !0), h || (this[d + "Setter"] || this._defaultSetter).call(this, b, d, e), this.shadows && /^(width|height|visibility|x|y|d|transform|cx|cy|r)$/.test(d) && this.updateShadows(d, b);
this.doTransform && (this.updateTransform(), this.doTransform = !1)
}
c && c();
return g
},
updateShadows: function (a, b) {
for (var c = this.shadows, d = c.length; d--;) c[d].setAttribute(a, "height" === a ? Math.max(b - (c[d].cutHeight || 0), 0) : "d" === a ? this.d : b)
},
addClass: function (a) {
var b = this.element, c = B(b, "class") || "";
-1 === c.indexOf(a) && B(b, "class", c + " " + a);
return this
},
symbolAttr: function (a) {
var b = this;
t("x y r start end width height innerR anchorX anchorY".split(" "), function (c) {
b[c] = z(a[c], b[c])
});
b.attr({d: b.renderer.symbols[b.symbolName](b.x, b.y, b.width, b.height, b)})
},
clip: function (a) {
return this.attr("clip-path", a ? "url(" + this.renderer.url + "#" + a.id + ")" : "none")
},
crisp: function (a) {
var b, c = {}, d, e = a.strokeWidth || this.strokeWidth || 0;
d = R(e) % 2 / 2;
a.x = ea(a.x || this.x || 0) + d;
a.y = ea(a.y || this.y || 0) + d;
a.width = ea((a.width || this.width || 0) - 2 * d);
a.height = ea((a.height || this.height || 0) - 2 * d);
a.strokeWidth = e;
for (b in a) this[b] !== a[b] && (this[b] = c[b] = a[b]);
return c
},
css: function (a) {
var b = this.styles, c = {}, d = this.element, e, f, g = "";
e = !b;
a && a.color && (a.fill = a.color);
if (b) for (f in a) a[f] !== b[f] && (c[f] = a[f], e = !0);
if (e) {
e = this.textWidth = a && a.width && "text" === d.nodeName.toLowerCase() && F(a.width) || this.textWidth;
b && (a = O(b, c));
this.styles = a;
e && (za || !sa && this.renderer.forExport) && delete a.width;
if (Ha && !sa) E(this.element, a); else {
b = function (a, b) {
return "-" + b.toLowerCase()
};
for (f in a) g += f.replace(/([A-Z])/g, b) + ":" + a[f] + ";";
B(d, "style", g)
}
e && this.added && this.renderer.buildText(this)
}
return this
},
on: function (a, b) {
var c = this, d = c.element;
$a && "click" === a ? (d.ontouchstart = function (a) {
c.touchEventFired = ya.now();
a.preventDefault();
b.call(d, a)
}, d.onclick = function (a) {
(-1 === Ja.indexOf("Android") || 1100 < ya.now() - (c.touchEventFired || 0)) && b.call(d, a)
}) : d["on" + a] = b;
return this
},
setRadialReference: function (a) {
var b = this.renderer.gradients[this.element.gradient];
this.element.radialReference = a;
b && b.radAttr && b.animate(this.renderer.getRadialAttr(a, b.radAttr));
return this
},
translate: function (a, b) {
return this.attr({translateX: a, translateY: b})
},
invert: function () {
this.inverted = !0;
this.updateTransform();
return this
},
updateTransform: function () {
var a = this.translateX || 0, b = this.translateY || 0, c = this.scaleX, d = this.scaleY, e = this.inverted,
f = this.rotation, g = this.element;
e && (a += this.attr("width"), b += this.attr("height"));
a = ["translate(" + a + "," + b + ")"];
e ? a.push("rotate(90) scale(-1,1)") : f && a.push("rotate(" + f + " " + (g.getAttribute("x") || 0) + " " + (g.getAttribute("y") || 0) + ")");
(u(c) || u(d)) && a.push("scale(" + z(c, 1) + " " + z(d, 1) + ")");
a.length && g.setAttribute("transform", a.join(" "))
},
toFront: function () {
var a = this.element;
a.parentNode.appendChild(a);
return this
},
align: function (a, b, c) {
var d, e, f, g, h = {};
e = this.renderer;
f = e.alignedObjects;
if (a) {
if (this.alignOptions = a, this.alignByTranslate = b, !c || ha(c)) this.alignTo = d = c || "renderer", M(f, this), f.push(this), c = null
} else a = this.alignOptions, b = this.alignByTranslate, d = this.alignTo;
c = z(c, e[d], e);
d = a.align;
e = a.verticalAlign;
f = (c.x || 0) + (a.x || 0);
g = (c.y || 0) + (a.y || 0);
if ("right" === d || "center" === d) f += (c.width - (a.width || 0)) / {right: 1, center: 2}[d];
h[b ? "translateX" : "x"] = R(f);
if ("bottom" === e || "middle" === e) g += (c.height - (a.height || 0)) / ({bottom: 1, middle: 2}[e] || 1);
h[b ? "translateY" : "y"] = R(g);
this[this.placed ? "animate" : "attr"](h);
this.placed = !0;
this.alignAttr = h;
return this
},
getBBox: function (a, b) {
var c, d = this.renderer, e, f, g, h = this.element, k = this.styles;
e = this.textStr;
var l, m = h.style, w, y = d.cache, x = d.cacheKeys, T;
f = z(b, this.rotation);
g = f * Ma;
e !== J && (T = ["", f || 0, k && k.fontSize, h.style.width].join(), T = "" === e || Tb.test(e) ? "num:" + e.toString().length + T : e + T);
T && !a && (c = y[T]);
if (!c) {
if ("http://www.w3.org/2000/svg" === h.namespaceURI || d.forExport) {
try {
w = this.fakeTS && function (a) {
t(h.querySelectorAll(".highcharts-text-shadow"), function (b) {
b.style.display = a
})
}, Za && m.textShadow ? (l = m.textShadow, m.textShadow = "") : w && w("none"), c = h.getBBox ? O({}, h.getBBox()) : {
width: h.offsetWidth,
height: h.offsetHeight
}, l ? m.textShadow = l : w && w("")
} catch (I) {
}
if (!c || 0 > c.width) c = {width: 0, height: 0}
} else c = this.htmlGetBBox();
d.isSVG && (d = c.width, e = c.height, Ha && k && "11px" === k.fontSize && "16.9" === e.toPrecision(3) && (c.height = e = 14), f && (c.width = fa(e * Ca(g)) + fa(d * va(g)), c.height = fa(e * va(g)) + fa(d * Ca(g))));
if (T) {
for (; 250 < x.length;) delete y[x.shift()];
y[T] || x.push(T);
y[T] = c
}
}
return c
},
show: function (a) {
return this.attr({visibility: a ? "inherit" : "visible"})
},
hide: function () {
return this.attr({visibility: "hidden"})
},
fadeOut: function (a) {
var b = this;
b.animate({opacity: 0}, {
duration: a || 150, complete: function () {
b.attr({y: -9999})
}
})
},
add: function (a) {
var b = this.renderer, c = this.element, d;
a && (this.parentGroup = a);
this.parentInverted = a && a.inverted;
void 0 !== this.textStr && b.buildText(this);
this.added = !0;
if (!a || a.handleZ || this.zIndex) d = this.zIndexSetter();
d || (a ? a.element : b.box).appendChild(c);
if (this.onAdd) this.onAdd();
return this
},
safeRemoveChild: function (a) {
var b = a.parentNode;
b && b.removeChild(a)
},
destroy: function () {
var a = this, b = a.element || {}, c = a.shadows,
d = a.renderer.isSVG && "SPAN" === b.nodeName && a.parentGroup, e, f;
b.onclick = b.onmouseout = b.onmouseover = b.onmousemove = b.point = null;
Oa(a);
a.clipPath && (a.clipPath = a.clipPath.destroy());
if (a.stops) {
for (f = 0; f < a.stops.length; f++) a.stops[f] = a.stops[f].destroy();
a.stops = null
}
a.safeRemoveChild(b);
for (c && t(c, function (b) {
a.safeRemoveChild(b)
}); d && d.div && 0 === d.div.childNodes.length;) b = d.parentGroup, a.safeRemoveChild(d.div), delete d.div, d = b;
a.alignTo && M(a.renderer.alignedObjects, a);
for (e in a) delete a[e];
return null
},
shadow: function (a, b, c) {
var d = [], e, f, g = this.element, h, k, l, m;
if (a) {
k = z(a.width, 3);
l = (a.opacity || .15) / k;
m = this.parentInverted ? "(-1,-1)" : "(" + z(a.offsetX, 1) + ", " + z(a.offsetY, 1) + ")";
for (e = 1; e <= k; e++) f = g.cloneNode(0), h = 2 * k + 1 - 2 * e, B(f, {
isShadow: "true",
stroke: a.color || "black",
"stroke-opacity": l * e,
"stroke-width": h,
transform: "translate" + m,
fill: "none"
}), c && (B(f, "height", G(B(f, "height") - h, 0)), f.cutHeight = h), b ? b.element.appendChild(f) : g.parentNode.insertBefore(f, g), d.push(f);
this.shadows = d
}
return this
},
xGetter: function (a) {
"circle" === this.element.nodeName && (a = {x: "cx", y: "cy"}[a] || a);
return this._defaultGetter(a)
},
_defaultGetter: function (a) {
a = z(this[a], this.element ? this.element.getAttribute(a) : null, 0);
/^[\-0-9\.]+$/.test(a) && (a = parseFloat(a));
return a
},
dSetter: function (a, b, c) {
a && a.join && (a = a.join(" "));
/(NaN| {2}|^$)/.test(a) && (a = "M 0 0");
c.setAttribute(b, a);
this[b] = a
},
dashstyleSetter: function (a) {
var b;
if (a = a && a.toLowerCase()) {
a = a.replace("shortdashdotdot", "3,1,1,1,1,1,").replace("shortdashdot", "3,1,1,1").replace("shortdot", "1,1,").replace("shortdash", "3,1,").replace("longdash", "8,3,").replace(/dot/g, "1,3,").replace("dash", "4,3,").replace(/,$/, "").split(",");
for (b = a.length; b--;) a[b] = F(a[b]) * this["stroke-width"];
a = a.join(",").replace("NaN", "none");
this.element.setAttribute("stroke-dasharray", a)
}
},
alignSetter: function (a) {
this.element.setAttribute("text-anchor", {left: "start", center: "middle", right: "end"}[a])
},
opacitySetter: function (a, b, c) {
this[b] = a;
c.setAttribute(b, a)
},
titleSetter: function (a) {
var b = this.element.getElementsByTagName("title")[0];
b || (b = V.createElementNS("http://www.w3.org/2000/svg", "title"), this.element.appendChild(b));
b.appendChild(V.createTextNode(String(z(a), "").replace(/<[^>]*>/g, "")))
},
textSetter: function (a) {
a !== this.textStr && (delete this.bBox, this.textStr = a, this.added && this.renderer.buildText(this))
},
fillSetter: function (a, b, c) {
"string" === typeof a ? c.setAttribute(b, a) : a && this.colorGradient(a, b, c)
},
visibilitySetter: function (a, b, c) {
"inherit" === a ? c.removeAttribute(b) : c.setAttribute(b, a)
},
zIndexSetter: function (a, b) {
var c = this.renderer, d = this.parentGroup, c = (d || c).element || c.box, e, f, g = this.element, h;
e = this.added;
var k;
u(a) && (g.setAttribute(b, a), a = +a, this[b] === a && (e = !1), this[b] = a);
if (e) {
(a = this.zIndex) && d && (d.handleZ = !0);
d = c.childNodes;
for (k = 0; k < d.length && !h; k++) e = d[k], f = B(e, "zIndex"), e !== g && (F(f) > a || !u(a) && u(f)) && (c.insertBefore(g, e), h = !0);
h || c.appendChild(g)
}
return h
},
_defaultSetter: function (a, b, c) {
c.setAttribute(b, a)
}
};
ja.prototype.yGetter = ja.prototype.xGetter;
ja.prototype.translateXSetter = ja.prototype.translateYSetter = ja.prototype.rotationSetter = ja.prototype.verticalAlignSetter = ja.prototype.scaleXSetter = ja.prototype.scaleYSetter = function (a, b) {
this[b] = a;
this.doTransform = !0
};
ja.prototype["stroke-widthSetter"] = ja.prototype.strokeSetter = function (a, b, c) {
this[b] = a;
this.stroke && this["stroke-width"] ? (this.strokeWidth = this["stroke-width"], ja.prototype.fillSetter.call(this, this.stroke, "stroke", c), c.setAttribute("stroke-width", this["stroke-width"]), this.hasStroke = !0) : "stroke-width" === b && 0 === a && this.hasStroke && (c.removeAttribute("stroke"), this.hasStroke = !1)
};
var lb = function () {
this.init.apply(this, arguments)
};
lb.prototype = {
Element: ja, init: function (a, b, c, d, e, f) {
var g;
d = this.createElement("svg").attr({version: "1.1"}).css(this.getStyle(d));
g = d.element;
a.appendChild(g);
-1 === a.innerHTML.indexOf("xmlns") && B(g, "xmlns", "http://www.w3.org/2000/svg");
this.isSVG = !0;
this.box = g;
this.boxWrapper = d;
this.alignedObjects = [];
this.url = (Za || Ib) && V.getElementsByTagName("base").length ? v.location.href.replace(/#.*?$/, "").replace(/([\('\)])/g, "\\$1").replace(/ /g, "%20") : "";
this.createElement("desc").add().element.appendChild(V.createTextNode("Created with Highcharts 4.2.1 /Highstock 4.2.1"));
this.defs = this.createElement("defs").add();
this.allowHTML = f;
this.forExport = e;
this.gradients = {};
this.cache = {};
this.cacheKeys = [];
this.setSize(b, c, !1);
var h;
Za && a.getBoundingClientRect && (this.subPixelFix = b = function () {
E(a, {left: 0, top: 0});
h = a.getBoundingClientRect();
E(a, {left: Ba(h.left) - h.left + "px", top: Ba(h.top) - h.top + "px"})
}, b(), ga(v, "resize", b))
}, getStyle: function (a) {
return this.style = O({
fontFamily: '"Lucida Grande", "Lucida Sans Unicode", Arial, Helvetica, sans-serif',
fontSize: "12px"
}, a)
}, isHidden: function () {
return !this.boxWrapper.getBBox().width
}, destroy: function () {
var a = this.defs;
this.box = null;
this.boxWrapper = this.boxWrapper.destroy();
Qa(this.gradients || {});
this.gradients = null;
a && (this.defs = a.destroy());
this.subPixelFix && ma(v, "resize", this.subPixelFix);
return this.alignedObjects = null
}, createElement: function (a) {
var b = new this.Element;
b.init(this, a);
return b
}, draw: function () {
}, getRadialAttr: function (a, b) {
return {cx: a[0] - a[2] / 2 + b.cx * a[2], cy: a[1] - a[2] / 2 + b.cy * a[2], r: b.r * a[2]}
}, buildText: function (a) {
for (var b = a.element, c = this, d = c.forExport, e = z(a.textStr, "").toString(), f = -1 !== e.indexOf("<"), g = b.childNodes, h, k, l = B(b, "x"), m = a.styles, w = a.textWidth, y = m && m.lineHeight, x = m && m.textShadow, T = m && "ellipsis" === m.textOverflow, I = g.length, n = w && !a.added && this.box, u = function (a) {
return y ? F(y) : c.fontMetrics(/(px|em)$/.test(a && a.style.fontSize) ? a.style.fontSize : m && m.fontSize || c.style.fontSize || 12, a).h
}, q = function (a) {
return a.replace(/</g, "<").replace(/>/g, ">")
}; I--;) b.removeChild(g[I]);
f || x || T || -1 !== e.indexOf(" ") ? (h = /<.*style="([^"]+)".*>/, k = /<.*href="(http[^"]+)".*>/, n && n.appendChild(b), e = f ? e.replace(/<(b|strong)>/g, '').replace(/<(i|em)>/g, '').replace(//g, " ").split(//g) : [e], "" === e[e.length - 1] && e.pop(), t(e, function (e, f) {
var g, y = 0;
e = e.replace(//g, " |||");
g = e.split("|||");
t(g, function (e) {
if ("" !== e || 1 === g.length) {
var x = {}, I = V.createElementNS("http://www.w3.org/2000/svg", "tspan"), z;
h.test(e) && (z = e.match(h)[1].replace(/(;| |^)color([ :])/, "$1fill$2"), B(I, "style", z));
k.test(e) && !d && (B(I, "onclick", 'location.href="' + e.match(k)[1] + '"'), E(I, {cursor: "pointer"}));
e = q(e.replace(/<(.|\n)*?>/g, "") || " ");
if (" " !== e) {
I.appendChild(V.createTextNode(e));
y ? x.dx = 0 : f && null !== l && (x.x = l);
B(I, x);
b.appendChild(I);
!y && f && (!sa && d && E(I, {display: "block"}), B(I, "dy", u(I)));
if (w) {
for (var x = e.replace(/([^\^])-/g, "$1- ").split(" "), n = 1 < g.length || f || 1 < x.length && "nowrap" !== m.whiteSpace, t, r, p, kb = [], C = u(I), H = 1, v = a.rotation, X = e, mb = X.length; (n || T) && (x.length || kb.length);) a.rotation = 0, t = a.getBBox(!0), p = t.width, !sa && c.forExport && (p = c.measureSpanWidth(I.firstChild.data, a.styles)), t = p > w, void 0 === r && (r = t), T && r ? (mb /= 2, "" === X || !t && .5 > mb ? x = [] : (t && (r = !0), X = e.substring(0, X.length + (t ? -1 : 1) * Ba(mb)), x = [X + (3 < w ? "\u2026" : "")], I.removeChild(I.firstChild))) : t && 1 !== x.length ? (I.removeChild(I.firstChild), kb.unshift(x.pop())) : (x = kb, kb = [], x.length && (H++, I = V.createElementNS("http://www.w3.org/2000/svg", "tspan"), B(I, {
dy: C,
x: l
}), z && B(I, "style", z), b.appendChild(I)), p > w && (w = p)), x.length && I.appendChild(V.createTextNode(x.join(" ").replace(/- /g, "-")));
r && a.attr("title", a.textStr);
a.rotation = v
}
y++
}
}
})
}), n && n.removeChild(b), x && a.applyTextShadow && a.applyTextShadow(x)) : b.appendChild(V.createTextNode(q(e)))
}, getContrast: function (a) {
a = pa(a).rgba;
return 384 < a[0] + a[1] + a[2] ? "#000000" : "#FFFFFF"
}, button: function (a, b, c, d, e, f, g, h, k) {
var l = this.label(a, b, c, k, null, null, null, null, "button"), m = 0, w, y, x, T, I, z;
a = {x1: 0, y1: 0, x2: 0, y2: 1};
e = A({
"stroke-width": 1,
stroke: "#CCCCCC",
fill: {linearGradient: a, stops: [[0, "#FEFEFE"], [1, "#F6F6F6"]]},
r: 2,
padding: 5,
style: {color: "black"}
}, e);
x = e.style;
delete e.style;
f = A(e, {stroke: "#68A", fill: {linearGradient: a, stops: [[0, "#FFF"], [1, "#ACF"]]}}, f);
T = f.style;
delete f.style;
g = A(e, {stroke: "#68A", fill: {linearGradient: a, stops: [[0, "#9BD"], [1, "#CDF"]]}}, g);
I = g.style;
delete g.style;
h = A(e, {style: {color: "#CCC"}}, h);
z = h.style;
delete h.style;
ga(l.element, Ha ? "mouseover" : "mouseenter", function () {
3 !== m && l.attr(f).css(T)
});
ga(l.element, Ha ? "mouseout" : "mouseleave", function () {
3 !== m && (w = [e, f, g][m], y = [x, T, I][m], l.attr(w).css(y))
});
l.setState = function (a) {
(l.state = m = a) ? 2 === a ? l.attr(g).css(I) : 3 === a && l.attr(h).css(z) : l.attr(e).css(x)
};
return l.on("click", function (a) {
3 !== m && d.call(l, a)
}).attr(e).css(O({cursor: "default"}, x))
}, crispLine: function (a, b) {
a[1] === a[4] && (a[1] = a[4] = R(a[1]) - b % 2 / 2);
a[2] === a[5] && (a[2] = a[5] = R(a[2]) + b % 2 / 2);
return a
}, path: function (a) {
var b = {fill: "none"};
ia(a) ? b.d = a : W(a) && O(b, a);
return this.createElement("path").attr(b)
}, circle: function (a, b, c) {
a = W(a) ? a : {x: a, y: b, r: c};
b = this.createElement("circle");
b.xSetter = function (a) {
this.element.setAttribute("cx", a)
};
b.ySetter = function (a) {
this.element.setAttribute("cy", a)
};
return b.attr(a)
}, arc: function (a, b, c, d, e, f) {
W(a) && (b = a.y, c = a.r, d = a.innerR, e = a.start, f = a.end, a = a.x);
a = this.symbol("arc", a || 0, b || 0, c || 0, c || 0, {innerR: d || 0, start: e || 0, end: f || 0});
a.r = c;
return a
}, rect: function (a, b, c, d, e, f) {
e = W(a) ? a.r : e;
var g = this.createElement("rect");
a = W(a) ? a : a === J ? {} : {x: a, y: b, width: G(c, 0), height: G(d, 0)};
f !== J && (a.strokeWidth = f, a = g.crisp(a));
e && (a.r = e);
g.rSetter = function (a) {
B(this.element, {rx: a, ry: a})
};
return g.attr(a)
}, setSize: function (a, b, c) {
var d = this.alignedObjects, e = d.length;
this.width = a;
this.height = b;
for (this.boxWrapper[z(c, !0) ? "animate" : "attr"]({width: a, height: b}); e--;) d[e].align()
}, g: function (a) {
var b = this.createElement("g");
return u(a) ? b.attr({"class": "highcharts-" + a}) : b
}, image: function (a, b, c, d, e) {
var f = {preserveAspectRatio: "none"};
1 < arguments.length && O(f, {x: b, y: c, width: d, height: e});
f = this.createElement("image").attr(f);
f.element.setAttributeNS ? f.element.setAttributeNS("http://www.w3.org/1999/xlink", "href", a) : f.element.setAttribute("hc-svg-href", a);
return f
}, symbol: function (a, b, c, d, e, f) {
var g, h = this.symbols[a], h = h && h(R(b), R(c), d, e, f), k = /^url\((.*?)\)$/, l, m;
h ? (g = this.path(h), O(g, {
symbolName: a,
x: b,
y: c,
width: d,
height: e
}), f && O(g, f)) : k.test(a) && (m = function (a, b) {
a.element && (a.attr({
width: b[0],
height: b[1]
}), a.alignByTranslate || a.translate(R((d - b[0]) / 2), R((e - b[1]) / 2)))
}, l = a.match(k)[1], a = Kb[l] || f && f.width && f.height && [f.width, f.height], g = this.image(l).attr({
x: b,
y: c
}), g.isImg = !0, a ? m(g, a) : (g.attr({width: 0, height: 0}), ca("img", {
onload: function () {
0 === this.width && (E(this, {position: "absolute", top: "-999em"}), V.body.appendChild(this));
m(g, Kb[l] = [this.width, this.height]);
this.parentNode && this.parentNode.removeChild(this)
}, src: l
})));
return g
}, symbols: {
circle: function (a, b, c, d) {
var e = .166 * c;
return ["M", a + c / 2, b, "C", a + c + e, b, a + c + e, b + d, a + c / 2, b + d, "C", a - e, b + d, a - e, b, a + c / 2, b, "Z"]
}, square: function (a, b, c, d) {
return ["M", a, b, "L", a + c, b, a + c, b + d, a, b + d, "Z"]
}, triangle: function (a, b, c, d) {
return ["M", a + c / 2, b, "L", a + c, b + d, a, b + d, "Z"]
}, "triangle-down": function (a, b, c, d) {
return ["M", a, b, "L", a + c, b, a + c / 2, b + d, "Z"]
}, diamond: function (a, b, c, d) {
return ["M", a + c / 2, b, "L", a + c, b + d / 2, a + c / 2, b + d, a, b + d / 2, "Z"]
}, arc: function (a, b, c, d, e) {
var f = e.start;
c = e.r || c || d;
var g = e.end - .001;
d = e.innerR;
var h = e.open, k = va(f), l = Ca(f), m = va(g), g = Ca(g);
e = e.end - f < Da ? 0 : 1;
return ["M", a + c * k, b + c * l, "A", c, c, 0, e, 1, a + c * m, b + c * g, h ? "M" : "L", a + d * m, b + d * g, "A", d, d, 0, e, 0, a + d * k, b + d * l, h ? "" : "Z"]
}, callout: function (a, b, c, d, e) {
var f = U(e && e.r || 0, c, d), g = f + 6, h = e && e.anchorX;
e = e && e.anchorY;
var k;
k = ["M", a + f, b, "L", a + c - f, b, "C", a + c, b, a + c, b, a + c, b + f, "L", a + c, b + d - f, "C", a + c, b + d, a + c, b + d, a + c - f, b + d, "L", a + f, b + d, "C", a, b + d, a, b + d, a, b + d - f, "L", a, b + f, "C", a, b, a, b, a + f, b];
h && h > c && e > b + g && e < b + d - g ? k.splice(13, 3, "L", a + c, e - 6, a + c + 6, e, a + c, e + 6, a + c, b + d - f) : h && 0 > h && e > b + g && e < b + d - g ? k.splice(33, 3, "L", a, e + 6, a - 6, e, a, e - 6, a, b + f) : e && e > d && h > a + g && h < a + c - g ? k.splice(23, 3, "L", h + 6, b + d, h, b + d + 6, h - 6, b + d, a + f, b + d) : e && 0 > e && h > a + g && h < a + c - g && k.splice(3, 3, "L", h - 6, b, h, b - 6, h + 6, b, c - f, b);
return k
}
}, clipRect: function (a, b, c, d) {
var e = "highcharts-" + wb++, f = this.createElement("clipPath").attr({id: e}).add(this.defs);
a = this.rect(a, b, c, d, 0).add(f);
a.id = e;
a.clipPath = f;
a.count = 0;
return a
}, text: function (a, b, c, d) {
var e = za || !sa && this.forExport, f = {};
if (d && (this.allowHTML || !this.forExport)) {
// return this.html(a, b, c);
}
f.x = Math.round(b || 0);
c && (f.y = Math.round(c));
if (a || 0 === a) f.text = a;
a = this.createElement("text").attr(f);
e && a.css({position: "absolute"});
d || (a.xSetter = function (a, b, c) {
var d = c.getElementsByTagName("tspan"), e, f = c.getAttribute(b), y;
for (y = 0; y < d.length; y++) e = d[y], e.getAttribute(b) === f && e.setAttribute(b, a);
c.setAttribute(b, a)
});
return a
}, fontMetrics: function (a, b) {
var c, d;
a = a || this.style.fontSize;
!a && b && v.getComputedStyle && (b = b.element || b, a = (c = v.getComputedStyle(b, "")) && c.fontSize);
a = /px/.test(a) ? F(a) : /em/.test(a) ? 12 * parseFloat(a) : 12;
c = 24 > a ? a + 3 : R(1.2 * a);
d = R(.8 * c);
return {h: c, b: d, f: a}
}, rotCorr: function (a, b, c) {
var d = a;
b && c && (d = G(d * va(b * Ma), 4));
return {x: -a / 3 * Ca(b * Ma), y: d}
}, label: function (a, b, c, d, e, f, g, h, k) {
var l = this, m = l.g(k), w = l.text("", 0, 0, g).attr({zIndex: 1}), y, x, T = 0, I = 3, z = 0, n, q, r, p,
C = 0, H = {}, v, X, B, N, P;
B = function () {
var a, b;
a = w.element.style;
x = (void 0 === n || void 0 === q || m.styles.textAlign) && u(w.textStr) && w.getBBox();
m.width = (n || x.width || 0) + 2 * I + z;
m.height = (q || x.height || 0) + 2 * I;
v = I + l.fontMetrics(a && a.fontSize, w).b;
X && (y || (a = C, b = (h ? -v : 0) + C, m.box = y = d ? l.symbol(d, a, b, m.width, m.height, H) : l.rect(a, b, m.width, m.height, 0, H["stroke-width"]), y.isImg || y.attr("fill", "none"), y.add(m)), y.isImg || y.attr(O({
width: R(m.width),
height: R(m.height)
}, H)), H = null)
};
N = function () {
var a = m.styles, a = a && a.textAlign, b = z + I, c;
c = h ? 0 : v;
u(n) && x && ("center" === a || "right" === a) && (b += {center: .5, right: 1}[a] * (n - x.width));
if (b !== w.x || c !== w.y) w.attr("x", b), c !== J && w.attr("y", c);
w.x = b;
w.y = c
};
P = function (a, b) {
y ? y.attr(a, b) : H[a] = b
};
m.onAdd = function () {
w.add(m);
m.attr({text: a || 0 === a ? a : "", x: b, y: c});
y && u(e) && m.attr({anchorX: e, anchorY: f})
};
m.widthSetter = function (a) {
n = a
};
m.heightSetter = function (a) {
q = a
};
m.paddingSetter = function (a) {
u(a) && a !== I && (I = m.padding = a, N())
};
m.paddingLeftSetter = function (a) {
u(a) && a !== z && (z = a, N())
};
m.alignSetter = function (a) {
a = {left: 0, center: .5, right: 1}[a];
a !== T && (T = a, x && m.attr({x: b}))
};
m.textSetter = function (a) {
a !== J && w.textSetter(a);
B();
N()
};
m["stroke-widthSetter"] = function (a, b) {
a && (X = !0);
C = a % 2 / 2;
P(b, a)
};
m.strokeSetter = m.fillSetter = m.rSetter = function (a, b) {
"fill" === b && a && (X = !0);
P(b, a)
};
m.anchorXSetter = function (a, b) {
e = a;
P(b, R(a) - C - r)
};
m.anchorYSetter = function (a, b) {
f = a;
P(b, a - p)
};
m.xSetter = function (a) {
m.x = a;
T && (a -= T * ((n || x.width) + 2 * I));
r = R(a);
m.attr("translateX", r)
};
m.ySetter = function (a) {
p = m.y = R(a);
m.attr("translateY", p)
};
var M = m.css;
return O(m, {
css: function (a) {
if (a) {
var b = {};
a = A(a);
t(m.textProps, function (c) {
a[c] !== J && (b[c] = a[c], delete a[c])
});
w.css(b)
}
return M.call(m, a)
}, getBBox: function () {
return {width: x.width + 2 * I, height: x.height + 2 * I, x: x.x - I, y: x.y - I}
}, shadow: function (a) {
y && y.shadow(a);
return m
}, destroy: function () {
ma(m.element, "mouseenter");
ma(m.element, "mouseleave");
w && (w = w.destroy());
y && (y = y.destroy());
ja.prototype.destroy.call(m);
m = l = B = N = P = null
}
})
}
};
xa.prototype = {
addLabel: function () {
var a = this.axis, b = a.options, c = a.chart, d = a.categories, e = a.names, f = this.pos, g = b.labels,
h = a.tickPositions, k = f === h[0], l = f === h[h.length - 1], e = d ? z(d[f], e[f], f) : f,
d = this.label, h = h.info, m;
a.isDatetimeAxis && h && (m = b.dateTimeLabelFormats[h.higherRanks[f] || h.unitName]);
this.isFirst = k;
this.isLast = l;
b = a.labelFormatter.call({
axis: a,
chart: c,
isFirst: k,
isLast: l,
dateTimeLabelFormat: m,
value: a.isLog ? ua(P(e)) : e
});
u(d) ? d && d.attr({text: b}) : (this.labelLength = (this.label = d = u(b) && g.enabled ? c.renderer.text(b, 0, 0, g.useHTML).css(A(g.style)).add(a.labelGroup) : null) && d.getBBox().width, this.rotation = 0)
}, getLabelSize: function () {
return this.label ? this.label.getBBox()[this.axis.horiz ? "height" : "width"] : 0
}, handleOverflow: function (a) {
var b = this.axis, c = a.x, d = b.chart.chartWidth, e = b.chart.spacing, f = z(b.labelLeft, U(b.pos, e[3])),
e = z(b.labelRight, G(b.pos + b.len, d - e[1])), g = this.label, h = this.rotation,
k = {left: 0, center: .5, right: 1}[b.labelAlign], l = g.getBBox().width, m = b.slotWidth, w = 1, y,
x = {};
if (h) 0 > h && c - k * l < f ? y = R(c / va(h * Ma) - f) : 0 < h && c + k * l > e && (y = R((d - c) / va(h * Ma))); else if (d = c + (1 - k) * l, c - k * l < f ? m = a.x + m * (1 - k) - f : d > e && (m = e - a.x + m * k, w = -1), m = U(b.slotWidth, m), m < b.slotWidth && "center" === b.labelAlign && (a.x += w * (b.slotWidth - m - k * (b.slotWidth - U(l, m)))), l > m || b.autoRotation && g.styles.width) y = m;
y && (x.width = y, b.options.labels.style.textOverflow || (x.textOverflow = "ellipsis"), g.css(x))
}, getPosition: function (a, b, c, d) {
var e = this.axis, f = e.chart, g = d && f.oldChartHeight || f.chartHeight;
return {
x: a ? e.translate(b + c, null, null, d) + e.transB : e.left + e.offset + (e.opposite ? (d && f.oldChartWidth || f.chartWidth) - e.right - e.left : 0),
y: a ? g - e.bottom + e.offset - (e.opposite ? e.height : 0) : g - e.translate(b + c, null, null, d) - e.transB
}
}, getLabelPosition: function (a, b, c, d, e, f, g, h) {
var k = this.axis, l = k.transA, m = k.reversed, w = k.staggerLines, y = k.tickRotCorr || {x: 0, y: 0},
x = e.y;
u(x) || (x = 2 === k.side ? y.y + 8 : x = va(c.rotation * Ma) * (y.y - c.getBBox(!1, 0).height / 2));
a = a + e.x + y.x - (f && d ? f * l * (m ? -1 : 1) : 0);
b = b + x - (f && !d ? f * l * (m ? 1 : -1) : 0);
w && (c = g / (h || 1) % w, k.opposite && (c = w - c - 1), b += k.labelOffset / w * c);
return {x: a, y: R(b)}
}, getMarkPath: function (a, b, c, d, e, f) {
return f.crispLine(["M", a, b, "L", a + (e ? 0 : -c), b + (e ? c : 0)], d)
}, render: function (a, b, c) {
var d = this.axis, e = d.options, f = d.chart.renderer, g = d.horiz, h = this.type, k = this.label,
l = this.pos, m = e.labels, w = this.gridLine, y = h ? h + "Grid" : "grid", x = h ? h + "Tick" : "tick",
T = e[y + "LineWidth"], I = e[y + "LineColor"], n = e[y + "LineDashStyle"], q = e[x + "Length"],
y = z(e[x + "Width"], !h && d.isXAxis ? 1 : 0), r = e[x + "Color"], t = e[x + "Position"],
x = this.mark, u = m.step, p = !0, H = d.tickmarkOffset, C = this.getPosition(g, l, H, b), v = C.x,
C = C.y, X = g && v === d.pos + d.len || !g && C === d.pos ? -1 : 1;
c = z(c, 1);
this.isActive = !0;
if (T && (l = d.getPlotLinePath(l + H, T * X, b, !0), w === J && (w = {
stroke: I,
"stroke-width": T
}, n && (w.dashstyle = n), h || (w.zIndex = 1), b && (w.opacity = 0), this.gridLine = w = T ? f.path(l).attr(w).add(d.gridGroup) : null), !b && w && l)) w[this.isNew ? "attr" : "animate"]({
d: l,
opacity: c
});
y && q && ("inside" === t && (q = -q), d.opposite && (q = -q), h = this.getMarkPath(v, C, q, y * X, g, f), x ? x.animate({
d: h,
opacity: c
}) : this.mark = f.path(h).attr({stroke: r, "stroke-width": y, opacity: c}).add(d.axisGroup));
k && !isNaN(v) && (k.xy = C = this.getLabelPosition(v, C, k, g, m, H, a, u), this.isFirst && !this.isLast && !z(e.showFirstLabel, 1) || this.isLast && !this.isFirst && !z(e.showLastLabel, 1) ? p = !1 : !g || d.isRadial || m.step || m.rotation || b || 0 === c || this.handleOverflow(C), u && a % u && (p = !1), p && !isNaN(C.y) ? (C.opacity = c, k[this.isNew ? "attr" : "animate"](C), this.isNew = !1) : k.attr("y", -9999))
}, destroy: function () {
Qa(this, this.axis)
}
};
Q.PlotLineOrBand = function (a, b) {
this.axis = a;
b && (this.options = b, this.id = b.id)
};
Q.PlotLineOrBand.prototype = {
render: function () {
var a = this, b = a.axis, c = b.horiz, d = a.options, e = d.label, f = a.label, g = d.width, h = d.to,
k = d.from, l = u(k) && u(h), m = d.value, w = d.dashStyle, y = a.svgElem, x = [], T, I = d.color,
z = d.zIndex, n = d.events, q = {}, r = b.chart.renderer;
b.isLog && (k = p(k), h = p(h), m = p(m));
if (g) x = b.getPlotLinePath(m, g), q = {
stroke: I,
"stroke-width": g
}, w && (q.dashstyle = w); else if (l) x = b.getPlotBandPath(k, h, d), I && (q.fill = I), d.borderWidth && (q.stroke = d.borderColor, q["stroke-width"] = d.borderWidth); else return;
u(z) && (q.zIndex = z);
if (y) x ? (y.show(), y.animate({d: x})) : (y.hide(), f && (a.label = f = f.destroy())); else if (x && x.length && (a.svgElem = y = r.path(x).attr(q).add(), n)) for (T in d = function (b) {
y.on(b, function (c) {
n[b].apply(a, [c])
})
}, n) d(T);
e && u(e.text) && x && x.length && 0 < b.width && 0 < b.height && !x.flat ? (e = A({
align: c && l && "center",
x: c ? !l && 4 : 10,
verticalAlign: !c && l && "middle",
y: c ? l ? 16 : 10 : l ? 6 : -4,
rotation: c && !l && 90
}, e), f || (q = {
align: e.textAlign || e.align,
rotation: e.rotation
}, u(z) && (q.zIndex = z), a.label = f = r.text(e.text, 0, 0, e.useHTML).attr(q).css(e.style).add()), b = [x[1], x[4], l ? x[6] : x[1]], l = [x[2], x[5], l ? x[7] : x[2]], x = D(b), c = D(l), f.align(e, !1, {
x: x,
y: c,
width: Ia(b) - x,
height: Ia(l) - c
}), f.show()) : f && f.hide();
return a
}, destroy: function () {
M(this.axis.plotLinesAndBands, this);
delete this.axis;
Qa(this)
}
};
var wa = Q.Axis = function () {
this.init.apply(this, arguments)
};
wa.prototype = {
defaultOptions: {
dateTimeLabelFormats: {
millisecond: "%H:%M:%S.%L",
second: "%H:%M:%S",
minute: "%H:%M",
hour: "%H:%M",
day: "%e. %b",
week: "%e. %b",
month: "%b '%y",
year: "%Y"
},
endOnTick: !1,
gridLineColor: "#D8D8D8",
labels: {enabled: !0, style: {color: "#606060", cursor: "default", fontSize: "11px"}, x: 0, y: 15},
lineColor: "#C0D0E0",
lineWidth: 1,
minPadding: .01,
maxPadding: .01,
minorGridLineColor: "#E0E0E0",
minorGridLineWidth: 1,
minorTickColor: "#A0A0A0",
minorTickLength: 2,
minorTickPosition: "outside",
startOfWeek: 1,
startOnTick: !1,
tickColor: "#C0D0E0",
tickLength: 10,
tickmarkPlacement: "between",
tickPixelInterval: 100,
tickPosition: "outside",
title: {align: "middle", style: {color: "#707070"}},
type: "linear"
},
defaultYAxisOptions: {
endOnTick: !0,
gridLineWidth: 1,
tickPixelInterval: 72,
showLastLabel: !0,
labels: {x: -8, y: 3},
lineWidth: 0,
maxPadding: .05,
minPadding: .05,
startOnTick: !0,
title: {rotation: 270, text: "Values"},
stackLabels: {
enabled: !1, formatter: function () {
return Q.numberFormat(this.total, -1)
}, style: A(aa.line.dataLabels.style, {color: "#000000"})
}
},
defaultLeftAxisOptions: {labels: {x: -15, y: null}, title: {rotation: 270}},
defaultRightAxisOptions: {labels: {x: 15, y: null}, title: {rotation: 90}},
defaultBottomAxisOptions: {labels: {autoRotation: [-45], x: 0, y: null}, title: {rotation: 0}},
defaultTopAxisOptions: {labels: {autoRotation: [-45], x: 0, y: -15}, title: {rotation: 0}},
init: function (a, b) {
var c = b.isX;
this.chart = a;
this.horiz = a.inverted ? !c : c;
this.coll = (this.isXAxis = c) ? "xAxis" : "yAxis";
this.opposite = b.opposite;
this.side = b.side || (this.horiz ? this.opposite ? 0 : 2 : this.opposite ? 1 : 3);
this.setOptions(b);
var d = this.options, e = d.type;
this.labelFormatter = d.labels.formatter || this.defaultLabelFormatter;
this.userOptions = b;
this.minPixelPadding = 0;
this.reversed = d.reversed;
this.visible = !1 !== d.visible;
this.zoomEnabled = !1 !== d.zoomEnabled;
this.categories = d.categories || "category" === e;
this.names = this.names || [];
this.isLog = "logarithmic" === e;
this.isDatetimeAxis = "datetime" === e;
this.isLinked = u(d.linkedTo);
this.ticks = {};
this.labelEdge = [];
this.minorTicks = {};
this.plotLinesAndBands = [];
this.alternateBands = {};
this.len = 0;
this.minRange = this.userMinRange = d.minRange || d.maxZoom;
this.range = d.range;
this.offset = d.offset || 0;
this.stacks = {};
this.oldStacks = {};
this.stacksTouched = 0;
this.min = this.max = null;
this.crosshair = z(d.crosshair, S(a.options.tooltip.crosshairs)[c ? 0 : 1], !1);
var f, d = this.options.events;
-1 === Aa(this, a.axes) && (c && !this.isColorAxis ? a.axes.splice(a.xAxis.length, 0, this) : a.axes.push(this), a[this.coll].push(this));
this.series = this.series || [];
a.inverted && c && this.reversed === J && (this.reversed = !0);
this.removePlotLine = this.removePlotBand = this.removePlotBandOrLine;
for (f in d) ga(this, f, d[f]);
this.isLog && (this.val2lin = p, this.lin2val = P)
},
setOptions: function (a) {
this.options = A(this.defaultOptions, this.isXAxis ? {} : this.defaultYAxisOptions, [this.defaultTopAxisOptions, this.defaultRightAxisOptions, this.defaultBottomAxisOptions, this.defaultLeftAxisOptions][this.side], A(la[this.coll], a))
},
defaultLabelFormatter: function () {
var a = this.axis, b = this.value, c = a.categories, d = this.dateTimeLabelFormat,
e = la.lang.numericSymbols, f = e && e.length, g, h = a.options.labels.format,
a = a.isLog ? b : a.tickInterval;
if (h) g = X(h, this); else if (c) g = b; else if (d) g = Pa(d, b); else if (f && 1E3 <= a) for (; f-- && g === J;) c = Math.pow(1E3, f + 1), a >= c && 0 === 10 * b % c && null !== e[f] && (g = Q.numberFormat(b / c, -1) + e[f]);
g === J && (g = 1E4 <= fa(b) ? Q.numberFormat(b, -1) : Q.numberFormat(b, -1, J, ""));
return g
},
getSeriesExtremes: function () {
var a = this, b = a.chart;
a.hasVisibleSeries = !1;
a.dataMin = a.dataMax = a.threshold = null;
a.softThreshold = !a.isXAxis;
a.buildStacks && a.buildStacks();
t(a.series, function (c) {
if (c.visible || !b.options.chart.ignoreHiddenSeries) {
var d = c.options, e = d.threshold, f;
a.hasVisibleSeries = !0;
a.isLog && 0 >= e && (e = null);
if (a.isXAxis) d = c.xData, d.length && (a.dataMin = U(z(a.dataMin, d[0]), D(d)), a.dataMax = G(z(a.dataMax, d[0]), Ia(d))); else if (c.getExtremes(), f = c.dataMax, c = c.dataMin, u(c) && u(f) && (a.dataMin = U(z(a.dataMin, c), c), a.dataMax = G(z(a.dataMax, f), f)), u(e) && (a.threshold = e), !d.softThreshold || a.isLog) a.softThreshold = !1
}
})
},
translate: function (a, b, c, d, e, f) {
var g = this.linkedParent || this, h = 1, k = 0, l = d ? g.oldTransA : g.transA;
d = d ? g.oldMin : g.min;
var m = g.minPixelPadding;
e = (g.doPostTranslate || g.isLog && e) && g.lin2val;
l || (l = g.transA);
c && (h *= -1, k = g.len);
g.reversed && (h *= -1, k -= h * (g.sector || g.len));
b ? (a = a * h + k - m, a = a / l + d, e && (a = g.lin2val(a))) : (e && (a = g.val2lin(a)), "between" === f && (f = .5), a = h * (a - d) * l + k + h * m + (r(f) ? l * f * g.pointRange : 0));
return a
},
toPixels: function (a, b) {
return this.translate(a, !1, !this.horiz, null, !0) + (b ? 0 : this.pos)
},
toValue: function (a, b) {
return this.translate(a - (b ? 0 : this.pos), !0, !this.horiz, null, !0)
},
getPlotLinePath: function (a, b, c, d, e) {
var f = this.chart, g = this.left, h = this.top, k, l, m = c && f.oldChartHeight || f.chartHeight,
w = c && f.oldChartWidth || f.chartWidth, y;
k = this.transB;
var x = function (a, b, c) {
if (a < b || a > c) d ? a = U(G(b, a), c) : y = !0;
return a
};
e = z(e, this.translate(a, null, null, c));
a = c = R(e + k);
k = l = R(m - e - k);
isNaN(e) ? y = !0 : this.horiz ? (k = h, l = m - this.bottom, a = c = x(a, g, g + this.width)) : (a = g, c = w - this.right, k = l = x(k, h, h + this.height));
return y && !d ? null : f.renderer.crispLine(["M", a, k, "L", c, l], b || 1)
},
getLinearTickPositions: function (a, b, c) {
var d, e = ua(ea(b / a) * a), f = ua(Ba(c / a) * a), g = [];
if (b === c && r(b)) return [b];
for (b = e; b <= f;) {
g.push(b);
b = ua(b + a);
if (b === d) break;
d = b
}
return g
},
getMinorTickPositions: function () {
var a = this.options, b = this.tickPositions, c = this.minorTickInterval, d = [], e,
f = this.pointRangePadding || 0;
e = this.min - f;
var f = this.max + f, g = f - e;
if (g && g / c < this.len / 3) if (this.isLog) for (f = b.length, e = 1; e < f; e++) d = d.concat(this.getLogTickPositions(c, b[e - 1], b[e], !0)); else if (this.isDatetimeAxis && "auto" === a.minorTickInterval) d = d.concat(this.getTimeTicks(this.normalizeTimeTickInterval(c), e, f, a.startOfWeek)); else for (b = e + (b[0] - e) % c; b <= f; b += c) d.push(b);
0 !== d.length && this.trimTicks(d, a.startOnTick, a.endOnTick);
return d
},
adjustForMinRange: function () {
var a = this.options, b = this.min, c = this.max, d, e = this.dataMax - this.dataMin >= this.minRange, f, g,
h, k, l, m;
this.isXAxis && this.minRange === J && !this.isLog && (u(a.min) || u(a.max) ? this.minRange = null : (t(this.series, function (a) {
k = a.xData;
for (g = l = a.xIncrement ? 1 : k.length - 1; 0 < g; g--) if (h = k[g] - k[g - 1], f === J || h < f) f = h
}), this.minRange = U(5 * f, this.dataMax - this.dataMin)));
c - b < this.minRange && (m = this.minRange, d = (m - c + b) / 2, d = [b - d, z(a.min, b - d)], e && (d[2] = this.dataMin), b = Ia(d), c = [b + m, z(a.max, b + m)], e && (c[2] = this.dataMax), c = D(c), c - b < m && (d[0] = c - m, d[1] = z(a.min, c - m), b = Ia(d)));
this.min = b;
this.max = c
},
setAxisTranslation: function (a) {
var b = this, c = b.max - b.min, d = b.axisPointRange || 0, e, f = 0, g = 0, h = b.linkedParent,
k = !!b.categories, l = b.transA, m = b.isXAxis;
if (m || k || d) h ? (f = h.minPointOffset, g = h.pointRangePadding) : (t(b.series, function (a) {
var b = a.closestPointRange;
!a.noSharedTooltip && u(b) && (e = u(e) ? U(e, b) : b)
}), t(b.series, function (a) {
var c = k ? 1 : m ? z(a.options.pointRange, e, 0) : b.axisPointRange || 0;
a = a.options.pointPlacement;
d = G(d, c);
b.single || (f = G(f, ha(a) ? 0 : c / 2), g = G(g, "on" === a ? 0 : c))
})), h = b.ordinalSlope && e ? b.ordinalSlope / e : 1, b.minPointOffset = f *= h, b.pointRangePadding = g *= h, b.pointRange = U(d, c), m && (b.closestPointRange = e);
a && (b.oldTransA = l);
b.translationSlope = b.transA = l = b.len / (c + g || 1);
b.transB = b.horiz ? b.left : b.bottom;
b.minPixelPadding = l * f
},
minFromRange: function () {
return this.max - this.range
},
setTickInterval: function (a) {
var b = this, c = b.chart, d = b.options, e = b.isLog, f = b.isDatetimeAxis, g = b.isXAxis, h = b.isLinked,
k = d.maxPadding, l = d.minPadding, m = d.tickInterval, w = d.tickPixelInterval, y = b.categories,
x = b.threshold, T = b.softThreshold, I, n, q, C;
f || y || h || this.getTickAmount();
q = z(b.userMin, d.min);
C = z(b.userMax, d.max);
h ? (b.linkedParent = c[b.coll][d.linkedTo], c = b.linkedParent.getExtremes(), b.min = z(c.min, c.dataMin), b.max = z(c.max, c.dataMax), d.type !== b.linkedParent.options.type && L(11, 1)) : (!T && u(x) && (b.dataMin >= x ? (I = x, l = 0) : b.dataMax <= x && (n = x, k = 0)), b.min = z(q, I, b.dataMin), b.max = z(C, n, b.dataMax));
e && (!a && 0 >= U(b.min, z(b.dataMin, b.min)) && L(10, 1), b.min = ua(p(b.min), 15), b.max = ua(p(b.max), 15));
b.range && u(b.max) && (b.userMin = b.min = q = G(b.min, b.minFromRange()), b.userMax = C = b.max, b.range = null);
b.beforePadding && b.beforePadding();
b.adjustForMinRange();
!(y || b.axisPointRange || b.usePercentage || h) && u(b.min) && u(b.max) && (c = b.max - b.min) && (!u(q) && l && (b.min -= c * l), !u(C) && k && (b.max += c * k));
r(d.floor) && (b.min = G(b.min, d.floor));
r(d.ceiling) && (b.max = U(b.max, d.ceiling));
T && u(b.dataMin) && (x = x || 0, !u(q) && b.min < x && b.dataMin >= x ? b.min = x : !u(C) && b.max > x && b.dataMax <= x && (b.max = x));
b.tickInterval = b.min === b.max || void 0 === b.min || void 0 === b.max ? 1 : h && !m && w === b.linkedParent.options.tickPixelInterval ? m = b.linkedParent.tickInterval : z(m, this.tickAmount ? (b.max - b.min) / G(this.tickAmount - 1, 1) : void 0, y ? 1 : (b.max - b.min) * w / G(b.len, w));
g && !a && t(b.series, function (a) {
a.processData(b.min !== b.oldMin || b.max !== b.oldMax)
});
b.setAxisTranslation(!0);
b.beforeSetTickPositions && b.beforeSetTickPositions();
b.postProcessTickInterval && (b.tickInterval = b.postProcessTickInterval(b.tickInterval));
b.pointRange && !m && (b.tickInterval = G(b.pointRange, b.tickInterval));
a = z(d.minTickInterval, b.isDatetimeAxis && b.closestPointRange);
!m && b.tickInterval < a && (b.tickInterval = a);
f || e || m || (b.tickInterval = ta(b.tickInterval, null, N(b.tickInterval), z(d.allowDecimals, !(.5 < b.tickInterval && 5 > b.tickInterval && 1E3 < b.max && 9999 > b.max)), !!this.tickAmount));
!this.tickAmount && this.len && (b.tickInterval = b.unsquish());
this.setTickPositions()
},
setTickPositions: function () {
var a = this.options, b, c = a.tickPositions, d = a.tickPositioner, e = a.startOnTick, f = a.endOnTick, g;
this.tickmarkOffset = this.categories && "between" === a.tickmarkPlacement && 1 === this.tickInterval ? .5 : 0;
this.minorTickInterval = "auto" === a.minorTickInterval && this.tickInterval ? this.tickInterval / 5 : a.minorTickInterval;
this.tickPositions = b = c && c.slice();
!b && (b = this.isDatetimeAxis ? this.getTimeTicks(this.normalizeTimeTickInterval(this.tickInterval, a.units), this.min, this.max, a.startOfWeek, this.ordinalPositions, this.closestPointRange, !0) : this.isLog ? this.getLogTickPositions(this.tickInterval, this.min, this.max) : this.getLinearTickPositions(this.tickInterval, this.min, this.max), b.length > this.len && (b = [b[0], b.pop()]), this.tickPositions = b, d && (d = d.apply(this, [this.min, this.max]))) && (this.tickPositions = b = d);
this.isLinked || (this.trimTicks(b, e, f), this.min === this.max && u(this.min) && !this.tickAmount && (g = !0, this.min -= .5, this.max += .5), this.single = g, c || d || this.adjustTickAmount())
},
trimTicks: function (a, b, c) {
var d = a[0], e = a[a.length - 1], f = this.minPointOffset || 0;
b ? this.min = d : this.min - f > d && a.shift();
c ? this.max = e : this.max + f < e && a.pop();
0 === a.length && u(d) && a.push((e + d) / 2)
},
alignToOthers: function () {
var a = {}, b, c = this.options;
!1 !== this.chart.options.chart.alignTicks && !1 !== c.alignTicks && t(this.chart[this.coll], function (c) {
var e = c.options, e = [c.horiz ? e.left : e.top, e.width, e.height, e.pane].join();
c.series.length && (a[e] ? b = !0 : a[e] = 1)
});
return b
},
getTickAmount: function () {
var a = this.options, b = a.tickAmount, c = a.tickPixelInterval;
!u(a.tickInterval) && this.len < c && !this.isRadial && !this.isLog && a.startOnTick && a.endOnTick && (b = 2);
!b && this.alignToOthers() && (b = Ba(this.len / c) + 1);
4 > b && (this.finalTickAmt = b, b = 5);
this.tickAmount = b
},
adjustTickAmount: function () {
var a = this.tickInterval, b = this.tickPositions, c = this.tickAmount, d = this.finalTickAmt,
e = b && b.length;
if (e < c) {
for (; b.length < c;) b.push(ua(b[b.length -
1] + a));
this.transA *= (e - 1) / (c - 1);
this.max = b[b.length - 1]
} else e > c && (this.tickInterval *= 2, this.setTickPositions());
if (u(d)) {
for (a = c = b.length; a--;) (3 === d && 1 === a % 2 || 2 >= d && 0 < a && a < c - 1) && b.splice(a, 1);
this.finalTickAmt = J
}
},
setScale: function () {
var a, b;
this.oldMin = this.min;
this.oldMax = this.max;
this.oldAxisLength = this.len;
this.setAxisSize();
b = this.len !== this.oldAxisLength;
t(this.series, function (b) {
if (b.isDirtyData || b.isDirty || b.xAxis.isDirty) a = !0
});
b || a || this.isLinked || this.forceRedraw || this.userMin !== this.oldUserMin || this.userMax !== this.oldUserMax || this.alignToOthers() ? (this.resetStacks && this.resetStacks(), this.forceRedraw = !1, this.getSeriesExtremes(), this.setTickInterval(), this.oldUserMin = this.userMin, this.oldUserMax = this.userMax, this.isDirty || (this.isDirty = b || this.min !== this.oldMin || this.max !== this.oldMax)) : this.cleanStacks && this.cleanStacks()
},
setExtremes: function (a, b, c, d, e) {
var f = this, g = f.chart;
c = z(c, !0);
t(f.series, function (a) {
delete a.kdTree
});
e = O(e, {min: a, max: b});
da(f, "setExtremes", e, function () {
f.userMin = a;
f.userMax = b;
f.eventArgs = e;
c && g.redraw(d)
})
},
zoom: function (a, b) {
var c = this.dataMin, d = this.dataMax, e = this.options, f = U(c, z(e.min, c)), e = G(d, z(e.max, d));
this.allowZoomOutside || (u(c) && a <= f && (a = f), u(d) && b >= e && (b = e));
this.displayBtn = a !== J || b !== J;
this.setExtremes(a, b, !1, J, {trigger: "zoom"});
return !0
},
setAxisSize: function () {
var a = this.chart, b = this.options, c = b.offsetLeft || 0, d = this.horiz,
e = z(b.width, a.plotWidth - c + (b.offsetRight || 0)), f = z(b.height, a.plotHeight),
g = z(b.top, a.plotTop), b = z(b.left, a.plotLeft + c), c = /%$/;
c.test(f) && (f = parseFloat(f) / 100 * a.plotHeight);
c.test(g) && (g = parseFloat(g) / 100 * a.plotHeight + a.plotTop);
this.left = b;
this.top = g;
this.width = e;
this.height = f;
this.bottom = a.chartHeight - f - g;
this.right = a.chartWidth - e - b;
this.len = G(d ? e : f, 0);
this.pos = d ? b : g
},
getExtremes: function () {
var a = this.isLog;
return {
min: a ? ua(P(this.min)) : this.min,
max: a ? ua(P(this.max)) : this.max,
dataMin: this.dataMin,
dataMax: this.dataMax,
userMin: this.userMin,
userMax: this.userMax
}
},
getThreshold: function (a) {
var b = this.isLog, c = b ? P(this.min) : this.min, b = b ? P(this.max) : this.max;
null === a ? a = 0 > b ? b : c : c > a ? a = c : b < a && (a = b);
return this.translate(a, 0, 1, 0, 1)
},
autoLabelAlign: function (a) {
a = (z(a, 0) - 90 * this.side + 720) % 360;
return 15 < a && 165 > a ? "right" : 195 < a && 345 > a ? "left" : "center"
},
unsquish: function () {
var a = this.ticks, b = this.options.labels, c = this.horiz, d = this.tickInterval, e = d,
f = this.len / (((this.categories ? 1 : 0) + this.max - this.min) / d), g, h = b.rotation,
k = this.chart.renderer.fontMetrics(b.style.fontSize, a[0] && a[0].label), l, m = Number.MAX_VALUE, w,
y = function (a) {
a /= f || 1;
a = 1 < a ? Ba(a) : 1;
return a * d
};
c ? (w = !b.staggerLines && !b.step && (u(h) ? [h] : f < z(b.autoRotationLimit, 80) && b.autoRotation)) && t(w, function (a) {
var b;
if (a === h || a && -90 <= a && 90 >= a) l = y(fa(k.h / Ca(Ma * a))), b = l + fa(a / 360), b < m && (m = b, g = a, e = l)
}) : b.step || (e = y(k.h));
this.autoRotation = w;
this.labelRotation = z(g, h);
return e
},
renderUnsquish: function () {
var a = this.chart, b = a.renderer, c = this.tickPositions, d = this.ticks, e = this.options.labels,
f = this.horiz, g = a.margin, h = this.categories ? c.length : c.length - 1,
g = this.slotWidth = f && 2 > (e.step || 0) && !e.rotation && (this.staggerLines || 1) * a.plotWidth / h || !f && (g[3] && g[3] - a.spacing[3] || .33 * a.chartWidth),
k = G(1, R(g - 2 * (e.padding || 5))), l = {}, h = b.fontMetrics(e.style.fontSize, d[0] && d[0].label),
m = e.style.textOverflow, w, y = 0, x, z;
ha(e.rotation) || (l.rotation = e.rotation || 0);
if (this.autoRotation) t(c, function (a) {
(a = d[a]) && a.labelLength > y && (y = a.labelLength)
}), y > k && y > h.h ? l.rotation = this.labelRotation : this.labelRotation = 0; else if (g && (w = {width: k + "px"}, !m)) for (w.textOverflow = "clip", x = c.length; !f && x--;) if (z = c[x], k = d[z].label) if ("ellipsis" === k.styles.textOverflow && k.css({textOverflow: "clip"}), k.getBBox().height > this.len / c.length - (h.h - h.f) || d[z].labelLength > g) k.specCss = {textOverflow: "ellipsis"};
l.rotation && (w = {width: (y > .5 * a.chartHeight ? .33 * a.chartHeight : a.chartHeight) + "px"}, m || (w.textOverflow = "ellipsis"));
this.labelAlign = l.align = e.align || this.autoLabelAlign(this.labelRotation);
t(c, function (a) {
var b = (a = d[a]) && a.label;
b && (b.attr(l), w && b.css(A(w, b.specCss)), delete b.specCss, a.rotation = l.rotation)
});
this.tickRotCorr = b.rotCorr(h.b, this.labelRotation || 0, 0 !== this.side)
},
hasData: function () {
return this.hasVisibleSeries || u(this.min) && u(this.max) && !!this.tickPositions
},
getOffset: function () {
var a = this, b = a.chart, c = b.renderer, d = a.options, e = a.tickPositions, f = a.ticks, g = a.horiz,
h = a.side, k = b.inverted ? [1, 0, 3, 2][h] : h, l, m, w = 0, y, x = 0, n = d.title, I = d.labels,
q = 0, r = a.opposite, p = b.axisOffset, b = b.clipOffset, C = [-1, 1, 1, -1][h], H, v = a.axisParent;
l = a.hasData();
a.showAxis = m = l || z(d.showEmpty, !0);
a.staggerLines = a.horiz && I.staggerLines;
a.axisGroup || (a.gridGroup = c.g("grid").attr({zIndex: d.gridZIndex || 1}).add(v), a.axisGroup = c.g("axis").attr({zIndex: d.zIndex || 2}).add(v), a.labelGroup = c.g("axis-labels").attr({zIndex: I.zIndex || 7}).addClass("highcharts-" + a.coll.toLowerCase() + "-labels").add(v));
if (l || a.isLinked) t(e, function (b) {
f[b] ? f[b].addLabel() : f[b] = new xa(a, b)
}), a.renderUnsquish(), !1 === I.reserveSpace || 0 !== h && 2 !== h && {
1: "left",
3: "right"
}[h] !== a.labelAlign && "center" !== a.labelAlign || t(e, function (a) {
q = G(f[a].getLabelSize(), q)
}), a.staggerLines && (q *= a.staggerLines, a.labelOffset = q * (a.opposite ? -1 : 1)); else for (H in f) f[H].destroy(), delete f[H];
n && n.text && !1 !== n.enabled && (a.axisTitle || (a.axisTitle = c.text(n.text, 0, 0, n.useHTML).attr({
zIndex: 7,
rotation: n.rotation || 0,
align: n.textAlign || {low: r ? "right" : "left", middle: "center", high: r ? "left" : "right"}[n.align]
}).addClass("highcharts-" + this.coll.toLowerCase() + "-title").css(n.style).add(a.axisGroup), a.axisTitle.isNew = !0), m && (w = a.axisTitle.getBBox()[g ? "height" : "width"], y = n.offset, x = u(y) ? 0 : z(n.margin, g ? 5 : 10)), a.axisTitle[m ? "show" : "hide"](!0));
a.offset = C * z(d.offset, p[h]);
a.tickRotCorr = a.tickRotCorr || {x: 0, y: 0};
c = 2 === h ? a.tickRotCorr.y : 0;
g = Math.abs(q) + x + (q && C * (g ? z(I.y, a.tickRotCorr.y + 8) : I.x) - c);
a.axisTitleMargin = z(y, g);
p[h] = G(p[h], a.axisTitleMargin + w + C * a.offset, g);
d = d.offset ? 0 : 2 * ea(d.lineWidth / 2);
b[k] = G(b[k], d)
},
getLinePath: function (a) {
var b = this.chart, c = this.opposite, d = this.offset, e = this.horiz,
f = this.left + (c ? this.width : 0) + d, d = b.chartHeight - this.bottom - (c ? this.height : 0) + d;
c && (a *= -1);
return b.renderer.crispLine(["M", e ? this.left : f, e ? d : this.top, "L", e ? b.chartWidth - this.right : f, e ? d : b.chartHeight - this.bottom], a)
},
getTitlePosition: function () {
var a = this.horiz, b = this.left, c = this.top, d = this.len, e = this.options.title, f = a ? b : c,
g = this.opposite, h = this.offset, k = e.x || 0, l = e.y || 0, m = F(e.style.fontSize || 12),
d = {low: f + (a ? 0 : d), middle: f + d / 2, high: f + (a ? d : 0)}[e.align],
b = (a ? c + this.height : b) + (a ? 1 : -1) * (g ? -1 : 1) * this.axisTitleMargin + (2 === this.side ? m : 0);
return {x: a ? d + k : b + (g ? this.width : 0) + h + k, y: a ? b + l - (g ? this.height : 0) + h : d + l}
},
render: function () {
var a = this, b = a.chart, c = b.renderer, d = a.options, e = a.isLog, f = a.isLinked, g = a.tickPositions,
h = a.axisTitle, k = a.ticks, l = a.minorTicks, m = a.alternateBands, w = d.stackLabels,
y = d.alternateGridColor, x = a.tickmarkOffset, n = d.lineWidth, I,
q = b.hasRendered && u(a.oldMin) && !isNaN(a.oldMin), z = a.showAxis, r = c.globalAnimation, p, C;
a.labelEdge.length = 0;
a.overlap = !1;
t([k, l, m], function (a) {
for (var b in a) a[b].isActive = !1
});
if (a.hasData() || f) a.minorTickInterval && !a.categories && t(a.getMinorTickPositions(), function (b) {
l[b] || (l[b] = new xa(a, b, "minor"));
q && l[b].isNew && l[b].render(null, !0);
l[b].render(null, !1, 1)
}), g.length && (t(g, function (b, c) {
if (!f || b >= a.min && b <= a.max) k[b] || (k[b] = new xa(a, b)), q && k[b].isNew && k[b].render(c, !0, .1), k[b].render(c)
}), x && (0 === a.min || a.single) && (k[-1] || (k[-1] = new xa(a, -1, null, !0)), k[-1].render(-1))), y && t(g, function (c, d) {
C = g[d + 1] !== J ? g[d + 1] + x : a.max - x;
0 === d % 2 && c < a.max && C <= a.max + (b.polar ? -x : x) && (m[c] || (m[c] = new Q.PlotLineOrBand(a)), p = c + x, m[c].options = {
from: e ? P(p) : p,
to: e ? P(C) : C,
color: y
}, m[c].render(), m[c].isActive = !0)
}), a._addedPlotLB || (t((d.plotLines || []).concat(d.plotBands || []), function (b) {
a.addPlotBandOrLine(b)
}), a._addedPlotLB = !0);
t([k, l, m], function (a) {
var c, d, e = [], f = r ? r.duration || 500 : 0;
for (c in a) a[c].isActive || (a[c].render(c, !1, 0), a[c].isActive = !1, e.push(c));
oa(function () {
for (d = e.length; d--;) a[e[d]] && !a[e[d]].isActive && (a[e[d]].destroy(), delete a[e[d]])
}, a !== m && b.hasRendered && f ? f : 0)
});
n && (I = a.getLinePath(n), a.axisLine ? a.axisLine.animate({d: I}) : a.axisLine = c.path(I).attr({
stroke: d.lineColor,
"stroke-width": n,
zIndex: 7
}).add(a.axisGroup), a.axisLine[z ? "show" : "hide"](!0));
h && z && (h[h.isNew ? "attr" : "animate"](a.getTitlePosition()), h.isNew = !1);
w && w.enabled && a.renderStackTotals();
a.isDirty = !1
},
redraw: function () {
this.visible && (this.render(), t(this.plotLinesAndBands, function (a) {
a.render()
}));
t(this.series, function (a) {
a.isDirty = !0
})
},
destroy: function (a) {
var b = this, c = b.stacks, d, e = b.plotLinesAndBands;
a || ma(b);
for (d in c) Qa(c[d]), c[d] = null;
t([b.ticks, b.minorTicks, b.alternateBands], function (a) {
Qa(a)
});
for (a = e.length; a--;) e[a].destroy();
t("stackTotalGroup axisLine axisTitle axisGroup cross gridGroup labelGroup".split(" "), function (a) {
b[a] && (b[a] = b[a].destroy())
});
this.cross && this.cross.destroy()
},
drawCrosshair: function (a, b) {
var c, d = this.crosshair, e, f;
!this.crosshair || !1 === (u(b) || !z(d.snap, !0)) || b && b.series && b.series[this.coll] !== this ? this.hideCrosshair() : (z(d.snap, !0) ? u(b) && (c = this.isXAxis ? b.plotX : this.len - b.plotY) : c = this.horiz ? a.chartX - this.pos : this.len - a.chartY + this.pos, c = this.isRadial ? this.getPlotLinePath(this.isXAxis ? b.x : z(b.stackY, b.y)) || null : this.getPlotLinePath(null, null, null, null, c) || null, null === c ? this.hideCrosshair() : (e = this.categories && !this.isRadial, f = z(d.width, e ? this.transA : 1), this.cross ? this.cross.attr({
d: c,
visibility: "visible",
"stroke-width": f
}) : (e = {
"stroke-width": f,
stroke: d.color || (e ? "rgba(155,200,255,0.2)" : "#C0C0C0"),
zIndex: z(d.zIndex, 2)
}, d.dashStyle && (e.dashstyle = d.dashStyle), this.cross = this.chart.renderer.path(c).attr(e).add())))
},
hideCrosshair: function () {
this.cross && this.cross.hide()
}
};
O(wa.prototype, {
getPlotBandPath: function (a, b) {
var c = this.getPlotLinePath(b, null, null, !0), d = this.getPlotLinePath(a, null, null, !0);
d && c ? (d.flat = d.toString() === c.toString(), d.push(c[4], c[5], c[1], c[2])) : d = null;
return d
}, addPlotBand: function (a) {
return this.addPlotBandOrLine(a, "plotBands")
}, addPlotLine: function (a) {
return this.addPlotBandOrLine(a, "plotLines")
}, addPlotBandOrLine: function (a, b) {
var c = (new Q.PlotLineOrBand(this, a)).render(), d = this.userOptions;
c && (b && (d[b] = d[b] || [], d[b].push(a)), this.plotLinesAndBands.push(c));
return c
}, removePlotBandOrLine: function (a) {
for (var b = this.plotLinesAndBands, c = this.options, d = this.userOptions, e = b.length; e--;) b[e].id === a && b[e].destroy();
t([c.plotLines || [], d.plotLines || [], c.plotBands || [], d.plotBands || []], function (b) {
for (e = b.length; e--;) b[e].id === a && M(b, b[e])
})
}
});
wa.prototype.getTimeTicks = function (a, b, c, d) {
var e = [], f = {}, g = la.global.useUTC, h, k = new ya(b - H(b)), l = a.unitRange, m = a.count;
if (u(b)) {
k[Eb](l >= Z.second ? 0 : m * ea(k.getMilliseconds() / m));
if (l >= Z.second) k[Fb](l >= Z.minute ? 0 : m * ea(k.getSeconds() / m));
if (l >= Z.minute) k[Gb](l >= Z.hour ? 0 : m * ea(k[qb]() / m));
if (l >= Z.hour) k[Hb](l >= Z.day ? 0 : m * ea(k[rb]() / m));
if (l >= Z.day) k[tb](l >= Z.month ? 1 : m * ea(k[Ua]() / m));
l >= Z.month && (k[ub](l >= Z.year ? 0 : m * ea(k[Va]() / m)), h = k[Wa]());
if (l >= Z.year) k[vb](h - h % m);
if (l === Z.week) k[tb](k[Ua]() - k[sb]() + z(d, 1));
b = 1;
if (pb || eb) k = k.getTime(), k = new ya(k + H(k));
h = k[Wa]();
d = k.getTime();
for (var w = k[Va](), y = k[Ua](), x = (Z.day + (g ? H(k) : 6E4 * k.getTimezoneOffset())) % Z.day; d < c;) e.push(d), d = l === Z.year ? ib(h + b * m, 0) : l === Z.month ? ib(h, w + b * m) : g || l !== Z.day && l !== Z.week ? d + l * m : ib(h, w, y + b * m * (l === Z.day ? 1 : 7)), b++;
e.push(d);
t(Na(e, function (a) {
return l <= Z.hour && a % Z.day === x
}), function (a) {
f[a] = "day"
})
}
e.info = O(a, {higherRanks: f, totalRange: l * m});
return e
};
wa.prototype.normalizeTimeTickInterval = function (a, b) {
var c = b || [["millisecond", [1, 2, 5, 10, 20, 25, 50, 100, 200, 500]], ["second", [1, 2, 5, 10, 15, 30]], ["minute", [1, 2, 5, 10, 15, 30]], ["hour", [1, 2, 3, 4, 6, 8, 12]], ["day", [1, 2]], ["week", [1, 2]], ["month", [1, 2, 3, 4, 6]], ["year", null]],
d = c[c.length - 1], e = Z[d[0]], f = d[1], g;
for (g = 0; g < c.length && !(d = c[g], e = Z[d[0]], f = d[1], c[g + 1] && a <= (e * f[f.length - 1] + Z[c[g + 1][0]]) / 2); g++) ;
e === Z.year && a < 5 * e && (f = [1, 2, 5]);
c = ta(a / e, f, "year" === d[0] ? G(N(a / e), 1) : 1);
return {unitRange: e, count: c, unitName: d[0]}
};
wa.prototype.getLogTickPositions = function (a, b, c, d) {
var e = this.options, f = this.len, g = [];
d || (this._minorAutoInterval = null);
if (.5 <= a) a = R(a), g = this.getLinearTickPositions(a, b, c); else if (.08 <= a) for (var f = ea(b), h, k, l, m, w, e = .3 < a ? [1, 2, 4] : .15 < a ? [1, 2, 4, 6, 8] : [1, 2, 3, 4, 5, 6, 7, 8, 9]; f < c + 1 && !w; f++) for (k = e.length, h = 0; h < k && !w; h++) l = p(P(f) * e[h]), l > b && (!d || m <= c) && m !== J && g.push(m), m > c && (w = !0), m = l; else b = P(b), c = P(c), a = e[d ? "minorTickInterval" : "tickInterval"], a = z("auto" === a ? null : a, this._minorAutoInterval, e.tickPixelInterval / (d ? 5 : 1) * (c - b) / ((d ? f / this.tickPositions.length : f) || 1)), a = ta(a, null, N(a)), g = Ea(this.getLinearTickPositions(a, b, c), p), d || (this._minorAutoInterval = a / 5);
d || (this.tickInterval = a);
return g
};
var Lb = Q.Tooltip = function () {
this.init.apply(this, arguments)
};
Lb.prototype = {
init: function (a, b) {
var c = b.borderWidth, d = b.style, e = F(d.padding);
this.chart = a;
this.options = b;
this.crosshairs = [];
this.now = {x: 0, y: 0};
this.isHidden = !0;
this.label = a.renderer.label("", 0, 0, b.shape || "callout", null, null, b.useHTML, null, "tooltip").attr({
padding: e,
fill: b.backgroundColor,
"stroke-width": c,
r: b.borderRadius,
zIndex: 8
}).css(d).css({padding: 0}).add().attr({y: -9999});
za || this.label.shadow(b.shadow);
this.shared = b.shared
}, destroy: function () {
this.label && (this.label = this.label.destroy());
clearTimeout(this.hideTimer);
clearTimeout(this.tooltipTimeout)
}, move: function (a, b, c, d) {
var e = this, f = e.now,
g = !1 !== e.options.animation && !e.isHidden && (1 < fa(a - f.x) || 1 < fa(b - f.y)),
h = e.followPointer || 1 < e.len;
O(f, {
x: g ? (2 * f.x + a) / 3 : a,
y: g ? (f.y + b) / 2 : b,
anchorX: h ? J : g ? (2 * f.anchorX + c) / 3 : c,
anchorY: h ? J : g ? (f.anchorY + d) / 2 : d
});
e.label.attr(f);
g && (clearTimeout(this.tooltipTimeout), this.tooltipTimeout = setTimeout(function () {
e && e.move(a, b, c, d)
}, 32))
}, hide: function (a) {
var b = this;
clearTimeout(this.hideTimer);
a = z(a, this.options.hideDelay, 500);
this.isHidden || (this.hideTimer = oa(function () {
b.label[a ? "fadeOut" : "hide"]();
b.isHidden = !0
}, a))
}, getAnchor: function (a, b) {
var c, d = this.chart, e = d.inverted, f = d.plotTop, g = d.plotLeft, h = 0, k = 0, l, m;
a = S(a);
c = a[0].tooltipPos;
this.followPointer && b && (b.chartX === J && (b = d.pointer.normalize(b)), c = [b.chartX - d.plotLeft, b.chartY - f]);
c || (t(a, function (a) {
l = a.series.yAxis;
m = a.series.xAxis;
h += a.plotX + (!e && m ? m.left - g : 0);
k += (a.plotLow ? (a.plotLow + a.plotHigh) / 2 : a.plotY) + (!e && l ? l.top - f : 0)
}), h /= a.length, k /= a.length, c = [e ? d.plotWidth - k : h, this.shared && !e && 1 < a.length && b ? b.chartY - f : e ? d.plotHeight - h : k]);
return Ea(c, R)
}, getPosition: function (a, b, c) {
var d = this.chart, e = this.distance, f = {}, g = c.h || 0, h,
k = ["y", d.chartHeight, b, c.plotY + d.plotTop, d.plotTop, d.plotTop + d.plotHeight],
l = ["x", d.chartWidth, a, c.plotX + d.plotLeft, d.plotLeft, d.plotLeft + d.plotWidth],
m = z(c.ttBelow, d.inverted && !c.negative || !d.inverted && c.negative),
w = function (a, b, c, d, h, k) {
var l = c < d - e, w = d + e + c < b, y = d - e - c;
d += e;
if (m && w) f[a] = d; else if (!m && l) f[a] = y; else if (l) f[a] = U(k - c, 0 > y - g ? y : y - g); else if (w) f[a] = G(h, d + g + c > b ? d : d + g); else return !1
}, y = function (a, b, c, d) {
var g;
d < e || d > b - e ? g = !1 : f[a] = d < c / 2 ? 1 : d > b - c / 2 ? b - c - 2 : d - c / 2;
return g
}, x = function (a) {
var b = k;
k = l;
l = b;
h = a
}, n = function () {
!1 !== w.apply(0, k) ? !1 !== y.apply(0, l) || h || (x(!0), n()) : h ? f.x = f.y = 0 : (x(!0), n())
};
(d.inverted || 1 < this.len) && x();
n();
return f
}, defaultFormatter: function (a) {
var b = this.points || S(this), c;
c = [a.tooltipFooterHeaderFormatter(b[0])];
c = c.concat(a.bodyFormatter(b));
c.push(a.tooltipFooterHeaderFormatter(b[0], !0));
return c.join("")
}, refresh: function (a, b) {
var c = this.chart, d = this.label, e = this.options, f, g, h, k = {}, l, m = [];
l = e.formatter || this.defaultFormatter;
var k = c.hoverPoints, w, y = this.shared;
clearTimeout(this.hideTimer);
this.followPointer = S(a)[0].series.tooltipOptions.followPointer;
h = this.getAnchor(a, b);
f = h[0];
g = h[1];
!y || a.series && a.series.noSharedTooltip ? k = a.getLabelConfig() : (c.hoverPoints = a, k && t(k, function (a) {
a.setState()
}), t(a, function (a) {
a.setState("hover");
m.push(a.getLabelConfig())
}), k = {x: a[0].category, y: a[0].y}, k.points = m, this.len = m.length, a = a[0]);
l = l.call(k, this);
k = a.series;
this.distance = z(k.tooltipOptions.distance, 16);
!1 === l ? this.hide() : (this.isHidden && (Oa(d), d.attr("opacity", 1).show()), d.attr({text: l}), w = e.borderColor || a.color || k.color || "#606060", d.attr({stroke: w}), this.updatePosition({
plotX: f,
plotY: g,
negative: a.negative,
ttBelow: a.ttBelow,
h: h[2] || 0
}), this.isHidden = !1);
da(c, "tooltipRefresh", {text: l, x: f + c.plotLeft, y: g + c.plotTop, borderColor: w})
}, updatePosition: function (a) {
var b = this.chart, c = this.label,
c = (this.options.positioner || this.getPosition).call(this, c.width, c.height, a);
this.move(R(c.x), R(c.y || 0), a.plotX + b.plotLeft, a.plotY + b.plotTop)
}, getXDateFormat: function (a, b, c) {
var d;
b = b.dateTimeLabelFormats;
var e = c && c.closestPointRange, f, g = {millisecond: 15, second: 12, minute: 9, hour: 6, day: 3}, h,
k = "millisecond";
if (e) {
h = Pa("%m-%d %H:%M:%S.%L", a.x);
for (f in Z) {
if (e === Z.week && +Pa("%w", a.x) === c.options.startOfWeek && "00:00:00.000" === h.substr(6)) {
f = "week";
break
}
if (Z[f] > e) {
f = k;
break
}
if (g[f] && h.substr(g[f]) !== "01-01 00:00:00.000".substr(g[f])) break;
"week" !== f && (k = f)
}
f && (d = b[f])
} else d = b.day;
return d || b.year
}, tooltipFooterHeaderFormatter: function (a, b) {
var c = b ? "footer" : "header", d = a.series, e = d.tooltipOptions, f = e.xDateFormat, g = d.xAxis,
h = g && "datetime" === g.options.type && r(a.key), c = e[c + "Format"];
h && !f && (f = this.getXDateFormat(a, e, g));
h && f && (c = c.replace("{point.key}", "{point.key:" + f + "}"));
return X(c, {point: a, series: d})
}, bodyFormatter: function (a) {
return Ea(a, function (a) {
var c = a.series.tooltipOptions;
return (c.pointFormatter || a.point.tooltipFormatter).call(a.point, c.pointFormat)
})
}
};
var Fa;
$a = V && V.documentElement.ontouchstart !== J;
var yb = Q.Pointer = function (a, b) {
this.init(a, b)
};
yb.prototype = {
init: function (a, b) {
var c = b.chart, d = c.events, e = za ? "" : c.zoomType, c = a.inverted, f;
this.options = b;
this.chart = a;
this.zoomX = f = /x/.test(e);
this.zoomY = e = /y/.test(e);
this.zoomHor = f && !c || e && c;
this.zoomVert = e && !c || f && c;
this.hasZoom = f || e;
this.runChartClick = d && !!d.click;
this.pinchDown = [];
this.lastValidTouch = {};
Q.Tooltip && b.tooltip.enabled && (a.tooltip = new Lb(a, b.tooltip), this.followTouchMove = z(b.tooltip.followTouchMove, !0));
this.setDOMEvents()
}, normalize: function (a, b) {
var c, d;
a = a || v.event;
a.target || (a.target = a.srcElement);
d = a.touches ? a.touches.length ? a.touches.item(0) : a.changedTouches[0] : a;
b || (this.chartPosition = b = xb(this.chart.container));
d.pageX === J ? (c = G(a.x, a.clientX - b.left), d = a.y) : (c = d.pageX - b.left, d = d.pageY - b.top);
return O(a, {chartX: R(c), chartY: R(d)})
}, getCoordinates: function (a) {
var b = {xAxis: [], yAxis: []};
t(this.chart.axes, function (c) {
b[c.isXAxis ? "xAxis" : "yAxis"].push({axis: c, value: c.toValue(a[c.horiz ? "chartX" : "chartY"])})
});
return b
}, runPointActions: function (a) {
var b = this.chart, c = b.series, d = b.tooltip, e = d ? d.shared : !1, f = b.hoverPoint, g = b.hoverSeries,
h, k = Number.MAX_VALUE, l, m, w, y = [], x, n;
if (!e && !g) for (h = 0; h < c.length; h++) if (c[h].directTouch || !c[h].options.stickyTracking) c = [];
g && (e ? g.noSharedTooltip : g.directTouch) && f ? x = f : (t(c, function (b) {
l = b.noSharedTooltip && e;
m = !e && b.directTouch;
b.visible && !l && !m && z(b.options.enableMouseTracking, !0) && (n = b.searchPoint(a, !l && 1 === b.kdDimensions)) && y.push(n)
}), t(y, function (a) {
w = e || 1 !== a.series.kdDimensions ? a.distX : a.dist;
a && "number" === typeof w && w < k && (k = w, x = a)
}));
if (x && (x !== this.prevKDPoint || d && d.isHidden)) {
if (e && !x.series.noSharedTooltip) {
for (h = y.length; h--;) (y[h].clientX !== x.clientX || y[h].series.noSharedTooltip) && y.splice(h, 1);
y.length && d && d.refresh(y, a);
t(y, function (b) {
b.onMouseOver(a, b !== (g && g.directTouch && f || x))
})
} else if (d && d.refresh(x, a), !g || !g.directTouch) x.onMouseOver(a);
this.prevKDPoint = x
} else c = g && g.tooltipOptions.followPointer, d && c && !d.isHidden && (c = d.getAnchor([{}], a), d.updatePosition({
plotX: c[0],
plotY: c[1]
}));
this._onDocumentMouseMove || (this._onDocumentMouseMove = function (a) {
if (ra[Fa]) ra[Fa].pointer.onDocumentMouseMove(a)
}, ga(V, "mousemove", this._onDocumentMouseMove));
t(b.axes, function (b) {
b.drawCrosshair(a, z(x, f))
})
}, reset: function (a, b) {
var c = this.chart, d = c.hoverSeries, e = c.hoverPoint, f = c.hoverPoints, g = c.tooltip,
h = g && g.shared ? f : e;
(a = a && g && h) && t(S(h), function (b) {
void 0 === b.plotX && (a = !1)
});
if (a) g.refresh(h), e && (e.setState(e.state, !0), t(c.axes, function (a) {
z(a.options.crosshair && a.options.crosshair.snap, !0) ? a.drawCrosshair(null, e) : a.hideCrosshair()
})); else {
if (e) e.onMouseOut();
f && t(f, function (a) {
a.setState()
});
if (d) d.onMouseOut();
g && g.hide(b);
this._onDocumentMouseMove && (ma(V, "mousemove", this._onDocumentMouseMove), this._onDocumentMouseMove = null);
t(c.axes, function (a) {
a.hideCrosshair()
});
this.hoverX = c.hoverPoints = c.hoverPoint = null
}
}, scaleGroups: function (a, b) {
var c = this.chart, d;
t(c.series, function (e) {
d = a || e.getPlotBox();
e.xAxis && e.xAxis.zoomEnabled && (e.group.attr(d), e.markerGroup && (e.markerGroup.attr(d), e.markerGroup.clip(b ? c.clipRect : null)), e.dataLabelsGroup && e.dataLabelsGroup.attr(d))
});
c.clipRect.attr(b || c.clipBox)
}, dragStart: function (a) {
var b = this.chart;
b.mouseIsDown = a.type;
b.cancelClick = !1;
b.mouseDownX = this.mouseDownX = a.chartX;
b.mouseDownY = this.mouseDownY = a.chartY
}, drag: function (a) {
var b = this.chart, c = b.options.chart, d = a.chartX, e = a.chartY, f = this.zoomHor, g = this.zoomVert,
h = b.plotLeft, k = b.plotTop, l = b.plotWidth, m = b.plotHeight, w, y = this.selectionMarker,
x = this.mouseDownX, n = this.mouseDownY, I = c.panKey && a[c.panKey + "Key"];
y && y.touch || (d < h ? d = h : d > h + l && (d = h + l), e < k ? e = k : e > k + m && (e = k + m), this.hasDragged = Math.sqrt(Math.pow(x - d, 2) + Math.pow(n - e, 2)), 10 < this.hasDragged && (w = b.isInsidePlot(x - h, n - k), b.hasCartesianSeries && (this.zoomX || this.zoomY) && w && !I && !y && (this.selectionMarker = y = b.renderer.rect(h, k, f ? 1 : l, g ? 1 : m, 0).attr({
fill: c.selectionMarkerFill || "rgba(69,114,167,0.25)",
zIndex: 7
}).add()), y && f && (d -= x, y.attr({
width: fa(d),
x: (0 < d ? 0 : d) + x
})), y && g && (d = e - n, y.attr({
height: fa(d),
y: (0 < d ? 0 : d) + n
})), w && !y && c.panning && b.pan(a, c.panning)))
}, drop: function (a) {
var b = this, c = this.chart, d = this.hasPinched;
if (this.selectionMarker) {
var e = {xAxis: [], yAxis: []}, f = this.selectionMarker, g = f.attr ? f.attr("x") : f.x,
h = f.attr ? f.attr("y") : f.y, k = f.attr ? f.attr("width") : f.width,
l = f.attr ? f.attr("height") : f.height, m;
if (this.hasDragged || d) t(c.axes, function (c) {
if (c.zoomEnabled && u(c.min) && (d || b[{xAxis: "zoomX", yAxis: "zoomY"}[c.coll]])) {
var f = c.horiz, x = "touchend" === a.type ? c.minPixelPadding : 0,
n = c.toValue((f ? g : h) + x), f = c.toValue((f ? g + k : h + l) - x);
e[c.coll].push({axis: c, min: U(n, f), max: G(n, f)});
m = !0
}
}), m && da(c, "selection", e, function (a) {
c.zoom(O(a, d ? {animation: !1} : null))
});
this.selectionMarker = this.selectionMarker.destroy();
d && this.scaleGroups()
}
c && (E(c.container, {cursor: c._cursor}), c.cancelClick = 10 < this.hasDragged, c.mouseIsDown = this.hasDragged = this.hasPinched = !1, this.pinchDown = [])
}, onContainerMouseDown: function (a) {
a = this.normalize(a);
a.preventDefault && a.preventDefault();
this.dragStart(a)
}, onDocumentMouseUp: function (a) {
ra[Fa] && ra[Fa].pointer.drop(a)
}, onDocumentMouseMove: function (a) {
var b = this.chart, c = this.chartPosition;
a = this.normalize(a, c);
!c || this.inClass(a.target, "highcharts-tracker") || b.isInsidePlot(a.chartX - b.plotLeft, a.chartY - b.plotTop) || this.reset()
}, onContainerMouseLeave: function () {
var a = ra[Fa];
a && (a.pointer.reset(), a.pointer.chartPosition = null)
}, onContainerMouseMove: function (a) {
var b = this.chart;
Fa = b.index;
a = this.normalize(a);
a.returnValue = !1;
"mousedown" === b.mouseIsDown && this.drag(a);
!this.inClass(a.target, "highcharts-tracker") && !b.isInsidePlot(a.chartX - b.plotLeft, a.chartY - b.plotTop) || b.openMenu || this.runPointActions(a)
}, inClass: function (a, b) {
for (var c; a;) {
if (c = B(a, "class")) {
if (-1 !== c.indexOf(b)) return !0;
if (-1 !== c.indexOf("highcharts-container")) return !1
}
a = a.parentNode
}
}, onTrackerMouseOut: function (a) {
var b = this.chart.hoverSeries;
a = a.relatedTarget || a.toElement;
if (b && !b.options.stickyTracking && !this.inClass(a, "highcharts-tooltip") && !this.inClass(a, "highcharts-series-" + b.index)) b.onMouseOut()
}, onContainerClick: function (a) {
var b = this.chart, c = b.hoverPoint, d = b.plotLeft, e = b.plotTop;
a = this.normalize(a);
b.cancelClick || (c && this.inClass(a.target, "highcharts-tracker") ? (da(c.series, "click", O(a, {point: c})), b.hoverPoint && c.firePointEvent("click", a)) : (O(a, this.getCoordinates(a)), b.isInsidePlot(a.chartX - d, a.chartY - e) && da(b, "click", a)))
}, setDOMEvents: function () {
var a = this, b = a.chart.container;
b.onmousedown = function (b) {
a.onContainerMouseDown(b)
};
b.onmousemove = function (b) {
a.onContainerMouseMove(b)
};
b.onclick = function (b) {
a.onContainerClick(b)
};
ga(b, "mouseleave", a.onContainerMouseLeave);
1 === ab && ga(V, "mouseup", a.onDocumentMouseUp);
$a && (b.ontouchstart = function (b) {
a.onContainerTouchStart(b)
}, b.ontouchmove = function (b) {
a.onContainerTouchMove(b)
}, 1 === ab && ga(V, "touchend", a.onDocumentTouchEnd))
}, destroy: function () {
var a;
ma(this.chart.container, "mouseleave", this.onContainerMouseLeave);
ab || (ma(V, "mouseup", this.onDocumentMouseUp), ma(V, "touchend", this.onDocumentTouchEnd));
clearInterval(this.tooltipTimeout);
for (a in this) this[a] = null
}
};
O(Q.Pointer.prototype, {
pinchTranslate: function (a, b, c, d, e, f) {
(this.zoomHor || this.pinchHor) && this.pinchTranslateDirection(!0, a, b, c, d, e, f);
(this.zoomVert || this.pinchVert) && this.pinchTranslateDirection(!1, a, b, c, d, e, f)
}, pinchTranslateDirection: function (a, b, c, d, e, f, g, h) {
var k = this.chart, l = a ? "x" : "y", m = a ? "X" : "Y", w = "chart" + m, y = a ? "width" : "height",
x = k["plot" + (a ? "Left" : "Top")], n, I, q = h || 1, z = k.inverted, r = k.bounds[a ? "h" : "v"],
p = 1 === b.length, u = b[0][w], t = c[0][w], C = !p && b[1][w], H = !p && c[1][w], v;
c = function () {
!p && 20 < fa(u - C) && (q = h || fa(t - H) / fa(u - C));
I = (x - t) / q + u;
n = k["plot" + (a ? "Width" : "Height")] / q
};
c();
b = I;
b < r.min ? (b = r.min, v = !0) : b + n > r.max && (b = r.max - n, v = !0);
v ? (t -= .8 * (t - g[l][0]), p || (H -= .8 * (H - g[l][1])), c()) : g[l] = [t, H];
z || (f[l] = I - x, f[y] = n);
f = z ? 1 / q : q;
e[y] = n;
e[l] = b;
d[z ? a ? "scaleY" : "scaleX" : "scale" + m] = q;
d["translate" + m] = f * x + (t - f * u)
}, pinch: function (a) {
var b = this, c = b.chart, d = b.pinchDown, e = a.touches, f = e.length, g = b.lastValidTouch,
h = b.hasZoom, k = b.selectionMarker, l = {},
m = 1 === f && (b.inClass(a.target, "highcharts-tracker") && c.runTrackerClick || b.runChartClick),
w = {};
1 < f && (b.initiated = !0);
h && b.initiated && !m && a.preventDefault();
Ea(e, function (a) {
return b.normalize(a)
});
"touchstart" === a.type ? (t(e, function (a, b) {
d[b] = {chartX: a.chartX, chartY: a.chartY}
}), g.x = [d[0].chartX, d[1] && d[1].chartX], g.y = [d[0].chartY, d[1] && d[1].chartY], t(c.axes, function (a) {
if (a.zoomEnabled) {
var b = c.bounds[a.horiz ? "h" : "v"], d = a.minPixelPadding,
e = a.toPixels(z(a.options.min, a.dataMin)), f = a.toPixels(z(a.options.max, a.dataMax)),
g = U(e, f), e = G(e, f);
b.min = U(a.pos, g - d);
b.max = G(a.pos + a.len, e + d)
}
}), b.res = !0) : d.length && (k || (b.selectionMarker = k = O({
destroy: ka,
touch: !0
}, c.plotBox)), b.pinchTranslate(d, e, l, k, w, g), b.hasPinched = h, b.scaleGroups(l, w), !h && b.followTouchMove && 1 === f ? this.runPointActions(b.normalize(a)) : b.res && (b.res = !1, this.reset(!1, 0)))
}, touch: function (a, b) {
var c = this.chart;
Fa = c.index;
1 === a.touches.length ? (a = this.normalize(a), c.isInsidePlot(a.chartX - c.plotLeft, a.chartY - c.plotTop) && !c.openMenu ? (b && this.runPointActions(a), this.pinch(a)) : b && this.reset()) : 2 === a.touches.length && this.pinch(a)
}, onContainerTouchStart: function (a) {
this.touch(a, !0)
}, onContainerTouchMove: function (a) {
this.touch(a)
}, onDocumentTouchEnd: function (a) {
ra[Fa] && ra[Fa].pointer.drop(a)
}
});
var nb = Q.Legend = function (a, b) {
this.init(a, b)
};
nb.prototype = {
init: function (a, b) {
var c = this, d = b.itemStyle, e = b.itemMarginTop || 0;
this.options = b;
b.enabled && (c.itemStyle = d, c.itemHiddenStyle = A(d, b.itemHiddenStyle), c.itemMarginTop = e, c.padding = d = z(b.padding, 8), c.initialItemX = d, c.initialItemY = d - 5, c.maxItemWidth = 0, c.chart = a, c.itemHeight = 0, c.symbolWidth = z(b.symbolWidth, 16), c.pages = [], c.render(), ga(c.chart, "endResize", function () {
c.positionCheckboxes()
}))
}, colorizeItem: function (a, b) {
var c = this.options, d = a.legendItem, e = a.legendLine, f = a.legendSymbol,
g = this.itemHiddenStyle.color, c = b ? c.itemStyle.color : g,
h = b ? a.legendColor || a.color || "#CCC" : g, g = a.options && a.options.marker, k = {fill: h}, l;
d && d.css({fill: c, color: c});
e && e.attr({stroke: h});
if (f) {
if (g && f.isMarker) for (l in k.stroke = h, g = a.convertAttribs(g), g) d = g[l], d !== J && (k[l] = d);
f.attr(k)
}
}, positionItem: function (a) {
var b = this.options, c = b.symbolPadding, b = !b.rtl, d = a._legendItemPos, e = d[0], d = d[1],
f = a.checkbox;
(a = a.legendGroup) && a.element && a.translate(b ? e : this.legendWidth - e - 2 * c - 4, d);
f && (f.x = e, f.y = d)
}, destroyItem: function (a) {
var b = a.checkbox;
t(["legendItem", "legendLine", "legendSymbol", "legendGroup"], function (b) {
a[b] && (a[b] = a[b].destroy())
});
b && gb(a.checkbox)
}, destroy: function () {
var a = this.group, b = this.box;
b && (this.box = b.destroy());
a && (this.group = a.destroy())
}, positionCheckboxes: function (a) {
var b = this.group.alignAttr, c, d = this.clipHeight || this.legendHeight, e = this.titleHeight;
b && (c = b.translateY, t(this.allItems, function (f) {
var g = f.checkbox, h;
g && (h = c + e + g.y + (a || 0) + 3, E(g, {
left: b.translateX + f.checkboxOffset + g.x - 20 + "px", top: h + "px", display: h > c -
6 && h < c + d - 6 ? "" : "none"
}))
}))
}, renderTitle: function () {
var a = this.padding, b = this.options.title, c = 0;
b.text && (this.title || (this.title = this.chart.renderer.label(b.text, a - 3, a - 4, null, null, null, null, null, "legend-title").attr({zIndex: 1}).css(b.style).add(this.group)), a = this.title.getBBox(), c = a.height, this.offsetWidth = a.width, this.contentGroup.attr({translateY: c}));
this.titleHeight = c
}, setText: function (a) {
var b = this.options;
a.legendItem.attr({text: b.labelFormat ? X(b.labelFormat, a) : b.labelFormatter.call(a)})
}, renderItem: function (a) {
var b = this.chart, c = b.renderer, d = this.options, e = "horizontal" === d.layout, f = this.symbolWidth,
g = d.symbolPadding, h = this.itemStyle, k = this.itemHiddenStyle, l = this.padding,
m = e ? z(d.itemDistance, 20) : 0, w = !d.rtl, y = d.width, x = d.itemMarginBottom || 0,
n = this.itemMarginTop, q = this.initialItemX, r = a.legendItem,
p = a.series && a.series.drawLegendSymbol ? a.series : a, t = p.options,
t = this.createCheckboxForItem && t && t.showCheckbox, u = d.useHTML;
r || (a.legendGroup = c.g("legend-item").attr({zIndex: 1}).add(this.scrollGroup), a.legendItem = r = c.text("", w ? f + g : -g, this.baseline || 0, u).css(A(a.visible ? h : k)).attr({
align: w ? "left" : "right",
zIndex: 2
}).add(a.legendGroup), this.baseline || (this.fontMetrics = c.fontMetrics(h.fontSize, r), this.baseline = this.fontMetrics.f + 3 + n, r.attr("y", this.baseline)), p.drawLegendSymbol(this, a), this.setItemEvents && this.setItemEvents(a, r, u, h, k), this.colorizeItem(a, a.visible), t && this.createCheckboxForItem(a));
this.setText(a);
c = r.getBBox();
f = a.checkboxOffset = d.itemWidth || a.legendItemWidth || f + g + c.width + m + (t ? 20 : 0);
this.itemHeight = g = R(a.legendItemHeight || c.height);
e && this.itemX - q + f > (y || b.chartWidth - 2 * l - q - d.x) && (this.itemX = q, this.itemY += n + this.lastLineHeight + x, this.lastLineHeight = 0);
this.maxItemWidth = G(this.maxItemWidth, f);
this.lastItemY = n + this.itemY + x;
this.lastLineHeight = G(g, this.lastLineHeight);
a._legendItemPos = [this.itemX, this.itemY];
e ? this.itemX += f : (this.itemY += n + g + x, this.lastLineHeight = g);
this.offsetWidth = y || G((e ? this.itemX - q - m : f) + l, this.offsetWidth)
}, getAllItems: function () {
var a = [];
t(this.chart.series, function (b) {
var c = b.options;
z(c.showInLegend, u(c.linkedTo) ? !1 : J, !0) && (a = a.concat(b.legendItems || ("point" === c.legendType ? b.data : b)))
});
return a
}, adjustMargins: function (a, b) {
var c = this.chart, d = this.options,
e = d.align.charAt(0) + d.verticalAlign.charAt(0) + d.layout.charAt(0);
this.display && !d.floating && t([/(lth|ct|rth)/, /(rtv|rm|rbv)/, /(rbh|cb|lbh)/, /(lbv|lm|ltv)/], function (f, g) {
f.test(e) && !u(a[g]) && (c[jb[g]] = G(c[jb[g]], c.legend[(g + 1) % 2 ? "legendHeight" : "legendWidth"] + [1, -1, -1, 1][g] * d[g % 2 ? "x" : "y"] + z(d.margin, 12) + b[g]))
})
}, render: function () {
var a = this, b = a.chart, c = b.renderer, d = a.group, e, f, g, h, k = a.box, l = a.options, m = a.padding,
w = l.borderWidth, y = l.backgroundColor;
a.itemX = a.initialItemX;
a.itemY = a.initialItemY;
a.offsetWidth = 0;
a.lastItemY = 0;
d || (a.group = d = c.g("legend").attr({zIndex: 7}).add(), a.contentGroup = c.g().attr({zIndex: 1}).add(d), a.scrollGroup = c.g().add(a.contentGroup));
a.renderTitle();
e = a.getAllItems();
fb(e, function (a, b) {
return (a.options && a.options.legendIndex || 0) - (b.options && b.options.legendIndex || 0)
});
l.reversed && e.reverse();
a.allItems = e;
a.display = f = !!e.length;
a.lastLineHeight = 0;
t(e, function (b) {
a.renderItem(b)
});
g = (l.width || a.offsetWidth) + m;
h = a.lastItemY + a.lastLineHeight + a.titleHeight;
h = a.handleOverflow(h);
h += m;
if (w || y) k ? 0 < g && 0 < h && (k[k.isNew ? "attr" : "animate"](k.crisp({
width: g,
height: h
})), k.isNew = !1) : (a.box = k = c.rect(0, 0, g, h, l.borderRadius, w || 0).attr({
stroke: l.borderColor,
"stroke-width": w || 0,
fill: y || "none"
}).add(d).shadow(l.shadow), k.isNew = !0), k[f ? "show" : "hide"]();
a.legendWidth = g;
a.legendHeight = h;
t(e, function (b) {
a.positionItem(b)
});
f && d.align(O({width: g, height: h}, l), !0, "spacingBox");
b.isResizing || this.positionCheckboxes()
}, handleOverflow: function (a) {
var b = this, c = this.chart, d = c.renderer, e = this.options, f = e.y,
f = c.spacingBox.height + ("top" === e.verticalAlign ? -f : f) - this.padding, g = e.maxHeight, h,
k = this.clipRect, l = e.navigation, m = z(l.animation, !0), w = l.arrowSize || 12, y = this.nav,
x = this.pages, n = this.padding, q, r = this.allItems, p = function (a) {
k.attr({height: a});
b.contentGroup.div && (b.contentGroup.div.style.clip = "rect(" + n + "px,9999px," + (n + a) + "px,0)")
};
"horizontal" === e.layout && (f /= 2);
g && (f = U(f, g));
x.length = 0;
a > f ? (this.clipHeight = h = G(f - 20 - this.titleHeight - n, 0), this.currentPage = z(this.currentPage, 1), this.fullHeight = a, t(r, function (a, b) {
var c = a._legendItemPos[1], d = R(a.legendItem.getBBox().height), e = x.length;
if (!e || c - x[e - 1] > h && (q || c) !== x[e - 1]) x.push(q || c), e++;
b === r.length - 1 && c + d - x[e - 1] > h && x.push(c);
c !== q && (q = c)
}), k || (k = b.clipRect = d.clipRect(0, n, 9999, 0), b.contentGroup.clip(k)), p(h), y || (this.nav = y = d.g().attr({zIndex: 1}).add(this.group), this.up = d.symbol("triangle", 0, 0, w, w).on("click", function () {
b.scroll(-1, m)
}).add(y), this.pager = d.text("", 15, 10).css(l.style).add(y), this.down = d.symbol("triangle-down", 0, 0, w, w).on("click", function () {
b.scroll(1, m)
}).add(y)), b.scroll(0), a = f) : y && (p(c.chartHeight), y.hide(), this.scrollGroup.attr({translateY: 1}), this.clipHeight = 0);
return a
}, scroll: function (a, b) {
var c = this.pages, d = c.length, e = this.currentPage + a, f = this.clipHeight,
g = this.options.navigation, h = g.activeColor, g = g.inactiveColor, k = this.pager, l = this.padding;
e > d && (e = d);
0 < e && (b !== J && Ra(b, this.chart), this.nav.attr({
translateX: l,
translateY: f + this.padding + 7 + this.titleHeight,
visibility: "visible"
}), this.up.attr({fill: 1 === e ? g : h}).css({cursor: 1 === e ? "default" : "pointer"}), k.attr({text: e + "/" + d}), this.down.attr({
x: 18 + this.pager.getBBox().width,
fill: e === d ? g : h
}).css({cursor: e === d ? "default" : "pointer"}), c = -c[e - 1] + this.initialItemY, this.scrollGroup.animate({translateY: c}), this.currentPage = e, this.positionCheckboxes(c))
}
};
var cb = Q.LegendSymbolMixin = {
drawRectangle: function (a, b) {
var c = a.options.symbolHeight || a.fontMetrics.f;
b.legendSymbol = this.chart.renderer.rect(0, a.baseline - c + 1, a.symbolWidth, c, a.options.symbolRadius || 0).attr({zIndex: 3}).add(b.legendGroup)
}, drawLineMarker: function (a) {
var b = this.options, c = b.marker, d = a.symbolWidth, e = this.chart.renderer, f = this.legendGroup;
a = a.baseline - R(.3 * a.fontMetrics.b);
var g;
b.lineWidth && (g = {"stroke-width": b.lineWidth}, b.dashStyle && (g.dashstyle = b.dashStyle), this.legendLine = e.path(["M", 0, a, "L", d, a]).attr(g).add(f));
c && !1 !== c.enabled && (b = c.radius, this.legendSymbol = c = e.symbol(this.symbol, d / 2 - b, a - b, 2 * b, 2 * b, c).add(f), c.isMarker = !0)
}
};
(/Trident\/7\.0/.test(Ja) || Za) && qa(nb.prototype, "positionItem", function (a, b) {
var c = this, d = function () {
b._legendItemPos && a.call(c, b)
};
d();
setTimeout(d)
});
var db = Q.Chart = function () {
this.getArgs.apply(this, arguments)
};
Q.chart = function (a, b, c) {
return new db(a, b, c)
};
db.prototype = {
callbacks: [], getArgs: function () {
var a = [].slice.call(arguments);
if (ha(a[0]) || a[0].nodeName) this.renderTo = a.shift();
this.init(a[0], a[1])
}, init: function (a, b) {
var c, d = a.series;
a.series = null;
c = A(la, a);
c.series = a.series = d;
this.userOptions = a;
d = c.chart;
this.margin = this.splashArray("margin", d);
this.spacing = this.splashArray("spacing", d);
var e = d.events;
this.bounds = {h: {}, v: {}};
this.callback = b;
this.isResizing = 0;
this.options = c;
this.axes = [];
this.series = [];
this.hasCartesianSeries = d.showAxes;
var f = this, g;
f.index = ra.length;
ra.push(f);
ab++;
!1 !== d.reflow && ga(f, "load", function () {
f.initReflow()
});
if (e) for (g in e) ga(f, g, e[g]);
f.xAxis = [];
f.yAxis = [];
f.animation = za ? !1 : z(d.animation, !0);
f.pointCount = f.colorCounter = f.symbolCounter = 0;
f.firstRender()
}, initSeries: function (a) {
var b = this.options.chart;
(b = K[a.type || b.type || b.defaultSeriesType]) || L(17, !0);
b = new b;
b.init(this, a);
return b
}, isInsidePlot: function (a, b, c) {
var d = c ? b : a;
a = c ? a : b;
return 0 <= d && d <= this.plotWidth && 0 <= a && a <= this.plotHeight
}, redraw: function (a) {
var b = this.axes, c = this.series, d = this.pointer, e = this.legend, f = this.isDirtyLegend, g, h,
k = this.hasCartesianSeries, l = this.isDirtyBox, m = c.length, w = m, y = this.renderer,
x = y.isHidden(), n = [];
Ra(a, this);
x && this.cloneRenderTo();
for (this.layOutTitles(); w--;) if (a = c[w], a.options.stacking && (g = !0, a.isDirty)) {
h = !0;
break
}
if (h) for (w = m; w--;) a = c[w], a.options.stacking && (a.isDirty = !0);
t(c, function (a) {
a.isDirty && "point" === a.options.legendType && (a.updateTotals && a.updateTotals(), f = !0)
});
f && e.options.enabled && (e.render(), this.isDirtyLegend = !1);
g && this.getStacks();
k && !this.isResizing && (this.maxTicks = null, t(b, function (a) {
a.setScale()
}));
this.getMargins();
k && (t(b, function (a) {
a.isDirty && (l = !0)
}), t(b, function (a) {
var b = a.min + "," + a.max;
a.extKey !== b && (a.extKey = b, n.push(function () {
da(a, "afterSetExtremes", O(a.eventArgs, a.getExtremes()));
delete a.eventArgs
}));
(l || g) && a.redraw()
}));
l && this.drawChartBox();
t(c, function (a) {
a.isDirty && a.visible && (!a.isCartesian || a.xAxis) && a.redraw()
});
d && d.reset(!0);
y.draw();
da(this, "redraw");
x && this.cloneRenderTo(!0);
t(n, function (a) {
a.call()
})
}, get: function (a) {
var b = this.axes, c = this.series, d, e;
for (d = 0; d < b.length; d++) if (b[d].options.id === a) return b[d];
for (d = 0; d < c.length; d++) if (c[d].options.id === a) return c[d];
for (d = 0; d < c.length; d++) for (e = c[d].points || [], b = 0; b < e.length; b++) if (e[b].id === a) return e[b];
return null
}, getAxes: function () {
var a = this, b = this.options, c = b.xAxis = S(b.xAxis || {}), b = b.yAxis = S(b.yAxis || {});
t(c, function (a, b) {
a.index = b;
a.isX = !0
});
t(b, function (a, b) {
a.index = b
});
c = c.concat(b);
t(c, function (b) {
new wa(a, b)
})
}, getSelectedPoints: function () {
var a = [];
t(this.series, function (b) {
a = a.concat(Na(b.points || [], function (a) {
return a.selected
}))
});
return a
}, getSelectedSeries: function () {
return Na(this.series, function (a) {
return a.selected
})
}, setTitle: function (a, b, c) {
var d = this, e = d.options, f;
f = e.title = A(e.title, a);
e = e.subtitle = A(e.subtitle, b);
t([["title", a, f], ["subtitle", b, e]], function (a) {
var b = a[0], c = d[b], e = a[1];
a = a[2];
c && e && (d[b] = c = c.destroy());
a && a.text && !c && (d[b] = d.renderer.text(a.text, 0, 0, a.useHTML).attr({
align: a.align,
"class": "highcharts-" + b,
zIndex: a.zIndex || 4
}).css(a.style).add())
});
d.layOutTitles(c)
}, layOutTitles: function (a) {
var b = 0, c = this.title, d = this.subtitle, e = this.options, f = e.title, e = e.subtitle,
g = this.renderer, h = this.spacingBox.width - 44;
c && (c.css({width: (f.width || h) + "px"}).align(O({y: g.fontMetrics(f.style.fontSize, c).b - 3}, f), !1, "spacingBox"), f.floating || f.verticalAlign || (b = c.getBBox().height));
d && (d.css({width: (e.width || h) + "px"}).align(O({y: b + (f.margin - 13) + g.fontMetrics(e.style.fontSize, c).b}, e), !1, "spacingBox"), e.floating || e.verticalAlign || (b = Ba(b + d.getBBox().height)));
c = this.titleOffset !== b;
this.titleOffset = b;
!this.isDirtyBox && c && (this.isDirtyBox = c, this.hasRendered && z(a, !0) && this.isDirtyBox && this.redraw())
}, getChartSize: function () {
var a = this.options.chart, b = a.width, a = a.height, c = this.renderToClone || this.renderTo;
u(b) || (this.containerWidth = La(c, "width"));
u(a) || (this.containerHeight = La(c, "height"));
this.chartWidth = G(0, b || this.containerWidth || 600);
this.chartHeight = G(0, z(a, 19 < this.containerHeight ? this.containerHeight : 400))
}, cloneRenderTo: function (a) {
var b = this.renderToClone, c = this.container;
a ? b && (this.renderTo.appendChild(c), gb(b), delete this.renderToClone) : (c && c.parentNode === this.renderTo && this.renderTo.removeChild(c), this.renderToClone = b = this.renderTo.cloneNode(0), E(b, {
position: "absolute",
top: "-9999px",
display: "block"
}), b.style.setProperty && b.style.setProperty("display", "block", "important"), V.body.appendChild(b), c && b.appendChild(c))
}, getContainer: function () {
var a, b = this.options, c = b.chart, d, e;
a = this.renderTo;
var f = "highcharts-" + wb++;
a || (this.renderTo = a = c.renderTo);
ha(a) && (this.renderTo = a = V.getElementById(a));
a || L(13, !0);
d = F(B(a, "data-highcharts-chart"));
!isNaN(d) && ra[d] && ra[d].hasRendered && ra[d].destroy();
B(a, "data-highcharts-chart", this.index);
a.innerHTML = "";
c.skipClone || a.offsetWidth || this.cloneRenderTo();
this.getChartSize();
d = this.chartWidth;
e = this.chartHeight;
this.container = a = ca("div", {
className: "highcharts-container" + (c.className ? " " + c.className : ""),
id: f
}, O({
position: "relative",
overflow: "hidden",
width: d + "px",
height: e + "px",
textAlign: "left",
lineHeight: "normal",
zIndex: 0,
"-webkit-tap-highlight-color": "rgba(0,0,0,0)"
}, c.style), this.renderToClone || a);
this._cursor = a.style.cursor;
this.renderer = new (Q[c.renderer] || lb)(a, d, e, c.style, c.forExport, b.exporting && b.exporting.allowHTML);
za && this.renderer.create(this, a, d, e);
this.renderer.chartIndex = this.index
}, getMargins: function (a) {
var b = this.spacing, c = this.margin, d = this.titleOffset;
this.resetMargins();
d && !u(c[0]) && (this.plotTop = G(this.plotTop, d + this.options.title.margin + b[0]));
this.legend.adjustMargins(c, b);
this.extraBottomMargin && (this.marginBottom += this.extraBottomMargin);
this.extraTopMargin && (this.plotTop += this.extraTopMargin);
a || this.getAxisMargins()
}, getAxisMargins: function () {
var a = this, b = a.axisOffset = [0, 0, 0, 0], c = a.margin;
a.hasCartesianSeries && t(a.axes, function (a) {
a.visible && a.getOffset()
});
t(jb, function (d, e) {
u(c[e]) || (a[d] += b[e])
});
a.setChartSize()
}, reflow: function (a) {
var b = this, c = b.options.chart, d = b.renderTo, e = c.width || La(d, "width"),
f = c.height || La(d, "height"), c = a ? a.target : v;
if (!b.hasUserSize && !b.isPrinting && e && f && (c === v || c === V)) {
if (e !== b.containerWidth || f !== b.containerHeight) clearTimeout(b.reflowTimeout), b.reflowTimeout = oa(function () {
b.container && (b.setSize(e, f, !1), b.hasUserSize = null)
}, a ? 100 : 0);
b.containerWidth = e;
b.containerHeight = f
}
}, initReflow: function () {
var a = this, b = function (b) {
a.reflow(b)
};
ga(v, "resize", b);
ga(a, "destroy", function () {
ma(v, "resize", b)
})
}, setSize: function (a, b, c) {
var d = this, e, f, g = d.renderer;
d.isResizing += 1;
Ra(c, d);
d.oldChartHeight = d.chartHeight;
d.oldChartWidth = d.chartWidth;
u(a) && (d.chartWidth = e = G(0, R(a)), d.hasUserSize = !!e);
u(b) && (d.chartHeight = f = G(0, R(b)));
a = g.globalAnimation;
(a ? Sa : E)(d.container, {width: e + "px", height: f + "px"}, a);
d.setChartSize(!0);
g.setSize(e, f, c);
d.maxTicks = null;
t(d.axes, function (a) {
a.isDirty = !0;
a.setScale()
});
t(d.series, function (a) {
a.isDirty = !0
});
d.isDirtyLegend = !0;
d.isDirtyBox = !0;
d.layOutTitles();
d.getMargins();
d.redraw(c);
d.oldChartHeight = null;
da(d, "resize");
a = g.globalAnimation;
oa(function () {
d && da(d, "endResize", null, function () {
--d.isResizing
})
}, !1 === a ? 0 : a && a.duration || 500)
}, setChartSize: function (a) {
var b = this.inverted, c = this.renderer, d = this.chartWidth, e = this.chartHeight, f = this.options.chart,
g = this.spacing, h = this.clipOffset, k, l, m, w;
this.plotLeft = k = R(this.plotLeft);
this.plotTop = l = R(this.plotTop);
this.plotWidth = m = G(0, R(d - k - this.marginRight));
this.plotHeight = w = G(0, R(e - l - this.marginBottom));
this.plotSizeX = b ? w : m;
this.plotSizeY = b ? m : w;
this.plotBorderWidth = f.plotBorderWidth || 0;
this.spacingBox = c.spacingBox = {x: g[3], y: g[0], width: d - g[3] - g[1], height: e - g[0] - g[2]};
this.plotBox = c.plotBox = {x: k, y: l, width: m, height: w};
d = 2 * ea(this.plotBorderWidth / 2);
b = Ba(G(d, h[3]) / 2);
c = Ba(G(d, h[0]) / 2);
this.clipBox = {
x: b, y: c, width: ea(this.plotSizeX -
G(d, h[1]) / 2 - b), height: G(0, ea(this.plotSizeY - G(d, h[2]) / 2 - c))
};
a || t(this.axes, function (a) {
a.setAxisSize();
a.setAxisTranslation()
})
}, resetMargins: function () {
var a = this;
t(jb, function (b, c) {
a[b] = z(a.margin[c], a.spacing[c])
});
a.axisOffset = [0, 0, 0, 0];
a.clipOffset = [0, 0, 0, 0]
}, drawChartBox: function () {
var a = this.options.chart, b = this.renderer, c = this.chartWidth, d = this.chartHeight,
e = this.chartBackground, f = this.plotBackground, g = this.plotBorder, h = this.plotBGImage,
k = a.borderWidth || 0, l = a.backgroundColor, m = a.plotBackgroundColor, w = a.plotBackgroundImage,
y = a.plotBorderWidth || 0, x, n = this.plotLeft, q = this.plotTop, z = this.plotWidth,
r = this.plotHeight, p = this.plotBox, t = this.clipRect, u = this.clipBox;
x = k + (a.shadow ? 8 : 0);
if (k || l) e ? e.animate(e.crisp({
width: c - x,
height: d - x
})) : (e = {fill: l || "none"}, k && (e.stroke = a.borderColor, e["stroke-width"] = k), this.chartBackground = b.rect(x / 2, x / 2, c - x, d - x, a.borderRadius, k).attr(e).addClass("highcharts-background").add().shadow(a.shadow));
m && (f ? f.animate(p) : this.plotBackground = b.rect(n, q, z, r, 0).attr({fill: m}).add().shadow(a.plotShadow));
w && (h ? h.animate(p) : this.plotBGImage = b.image(w, n, q, z, r).add());
t ? t.animate({width: u.width, height: u.height}) : this.clipRect = b.clipRect(u);
y && (g ? g.animate(g.crisp({
x: n,
y: q,
width: z,
height: r,
strokeWidth: -y
})) : this.plotBorder = b.rect(n, q, z, r, 0, -y).attr({
stroke: a.plotBorderColor,
"stroke-width": y,
fill: "none",
zIndex: 1
}).add());
this.isDirtyBox = !1
}, propFromSeries: function () {
var a = this, b = a.options.chart, c, d = a.options.series, e, f;
t(["inverted", "angular", "polar"], function (g) {
c = K[b.type || b.defaultSeriesType];
f = a[g] || b[g] || c && c.prototype[g];
for (e = d && d.length; !f && e--;) (c = K[d[e].type]) && c.prototype[g] && (f = !0);
a[g] = f
})
}, linkSeries: function () {
var a = this, b = a.series;
t(b, function (a) {
a.linkedSeries.length = 0
});
t(b, function (b) {
var d = b.options.linkedTo;
ha(d) && (d = ":previous" === d ? a.series[b.index - 1] : a.get(d)) && (d.linkedSeries.push(b), b.linkedParent = d, b.visible = z(b.options.visible, d.options.visible, b.visible))
})
}, renderSeries: function () {
t(this.series, function (a) {
a.translate();
a.render()
})
}, renderLabels: function () {
var a = this, b = a.options.labels;
b.items && t(b.items, function (c) {
var d = O(b.style, c.style), e = F(d.left) + a.plotLeft, f = F(d.top) + a.plotTop + 12;
delete d.left;
delete d.top;
a.renderer.text(c.html, e, f).attr({zIndex: 2}).css(d).add()
})
}, render: function () {
var a = this.axes, b = this.renderer, c = this.options, d, e, f, g;
this.setTitle();
this.legend = new nb(this, c.legend);
this.getStacks && this.getStacks();
this.getMargins(!0);
this.setChartSize();
d = this.plotWidth;
e = this.plotHeight -= 21;
t(a, function (a) {
a.setScale()
});
this.getAxisMargins();
f = 1.1 < d / this.plotWidth;
g = 1.05 < e / this.plotHeight;
if (f || g) this.maxTicks = null, t(a, function (a) {
(a.horiz && f || !a.horiz && g) && a.setTickInterval(!0)
}), this.getMargins();
this.drawChartBox();
this.hasCartesianSeries && t(a, function (a) {
a.visible && a.render()
});
this.seriesGroup || (this.seriesGroup = b.g("series-group").attr({zIndex: 3}).add());
this.renderSeries();
this.renderLabels();
this.showCredits(c.credits);
this.hasRendered = !0
}, showCredits: function (a) {
a.enabled && !this.credits && (this.credits = this.renderer.text(a.text, 0, 0).on("click", function () {
a.href && (v.location.href = a.href)
}).attr({align: a.position.align, zIndex: 8}).css(a.style).add().align(a.position))
}, destroy: function () {
var a = this, b = a.axes, c = a.series, d = a.container, e, f = d && d.parentNode;
da(a, "destroy");
ra[a.index] = J;
ab--;
a.renderTo.removeAttribute("data-highcharts-chart");
ma(a);
for (e = b.length; e--;) b[e] = b[e].destroy();
for (e = c.length; e--;) c[e] = c[e].destroy();
t("title subtitle chartBackground plotBackground plotBGImage plotBorder seriesGroup clipRect credits pointer scroller rangeSelector legend resetZoomButton tooltip renderer".split(" "), function (b) {
var c = a[b];
c && c.destroy && (a[b] = c.destroy())
});
d && (d.innerHTML = "", ma(d), f && gb(d));
for (e in a) delete a[e]
}, isReadyToRender: function () {
var a = this;
return !sa && v == v.top && "complete" !== V.readyState || za && !v.canvg ? (za ? CanVGController.push(function () {
a.firstRender()
}, a.options.global.canvasToolsURL) : V.attachEvent("onreadystatechange", function () {
V.detachEvent("onreadystatechange", a.firstRender);
"complete" === V.readyState && a.firstRender()
}), !1) : !0
}, firstRender: function () {
var a = this, b = a.options, c = a.callback;
a.isReadyToRender() && (a.getContainer(), da(a, "init"), a.resetMargins(), a.setChartSize(), a.propFromSeries(), a.getAxes(), t(b.series || [], function (b) {
a.initSeries(b)
}), a.linkSeries(), da(a, "beforeRender"), Q.Pointer && (a.pointer = new yb(a, b)), a.render(), a.renderer.draw(), c && c.apply(a, [a]), t(a.callbacks, function (b) {
a.index !== J && b.apply(a, [a])
}), da(a, "load"), a.cloneRenderTo(!0))
}, splashArray: function (a, b) {
var c = b[a], c = W(c) ? c : [c, c, c, c];
return [z(b[a + "Top"], c[0]), z(b[a + "Right"], c[1]), z(b[a + "Bottom"], c[2]), z(b[a + "Left"], c[3])]
}
};
var Mb = Q.CenteredSeriesMixin = {
getCenter: function () {
var a = this.options, b = this.chart, c = 2 * (a.slicedOffset || 0), d = b.plotWidth - 2 * c,
b = b.plotHeight - 2 * c, e = a.center,
e = [z(e[0], "50%"), z(e[1], "50%"), a.size || "100%", a.innerSize || 0], f = U(d, b), g, h;
for (g = 0; 4 > g; ++g) h = e[g], a = 2 > g || 2 === g && /%$/.test(h), e[g] = q(h, [d, b, f, e[2]][g]) + (a ? c : 0);
e[3] > e[2] && (e[3] = e[2]);
return e
}
}, Ga = function () {
};
Ga.prototype = {
init: function (a, b, c) {
this.series = a;
this.color = a.color;
this.applyOptions(b, c);
this.pointAttr = {};
a.options.colorByPoint && (b = a.options.colors || a.chart.options.colors, this.color = this.color || b[a.colorCounter++], a.colorCounter === b.length && (a.colorCounter = 0));
a.chart.pointCount++;
return this
}, applyOptions: function (a, b) {
var c = this.series, d = c.options.pointValKey || c.pointValKey;
a = Ga.prototype.optionsToObject.call(this, a);
O(this, a);
this.options = this.options ? O(this.options, a) : a;
d && (this.y = this[d]);
this.x === J && c && (this.x = b === J ? c.autoIncrement() : b);
return this
}, optionsToObject: function (a) {
var b = {}, c = this.series, d = c.options.keys, e = d || c.pointArrayMap || ["y"], f = e.length, g = 0,
h = 0;
if ("number" === typeof a || null === a) b[e[0]] = a; else if (ia(a)) for (!d && a.length > f && (c = typeof a[0], "string" === c ? b.name = a[0] : "number" === c && (b.x = a[0]), g++); h < f;) d && void 0 === a[g] || (b[e[h]] = a[g]), g++, h++; else "object" === typeof a && (b = a, a.dataLabels && (c._hasPointLabels = !0), a.marker && (c._hasPointMarkers = !0));
return b
}, destroy: function () {
var a = this.series.chart, b = a.hoverPoints, c;
a.pointCount--;
b && (this.setState(), M(b, this), b.length || (a.hoverPoints = null));
if (this === a.hoverPoint) this.onMouseOut();
if (this.graphic || this.dataLabel) ma(this), this.destroyElements();
this.legendItem && a.legend.destroyItem(this);
for (c in this) this[c] = null
}, destroyElements: function () {
for (var a = ["graphic", "dataLabel", "dataLabelUpper", "connector", "shadowGroup"], b, c = 6; c--;) b = a[c], this[b] && (this[b] = this[b].destroy())
}, getLabelConfig: function () {
return {
x: this.category,
y: this.y,
color: this.color,
key: this.name || this.category,
series: this.series,
point: this,
percentage: this.percentage,
total: this.total || this.stackTotal
}
}, tooltipFormatter: function (a) {
var b = this.series, c = b.tooltipOptions, d = z(c.valueDecimals, ""), e = c.valuePrefix || "",
f = c.valueSuffix || "";
t(b.pointArrayMap || ["y"], function (b) {
b = "{point." + b;
if (e || f) a = a.replace(b + "}", e + b + "}" + f);
a = a.replace(b + "}", b + ":,." + d + "f}")
});
return X(a, {point: this, series: this.series})
}, firePointEvent: function (a, b, c) {
var d = this, e = this.series.options;
(e.point.events[a] || d.options && d.options.events && d.options.events[a]) && this.importEvents();
"click" === a && e.allowPointSelect && (c = function (a) {
d.select && d.select(null, a.ctrlKey || a.metaKey || a.shiftKey)
});
da(this, a, b, c)
}, visible: !0
};
var Y = Q.Series = function () {
};
Y.prototype = {
isCartesian: !0,
type: "line",
pointClass: Ga,
sorted: !0,
requireSorting: !0,
pointAttrToOptions: {stroke: "lineColor", "stroke-width": "lineWidth", fill: "fillColor", r: "radius"},
directTouch: !1,
axisTypes: ["xAxis", "yAxis"],
colorCounter: 0,
parallelArrays: ["x", "y"],
init: function (a, b) {
var c = this, d, e, f = a.series, g = function (a, b) {
return z(a.options.index, a._i) - z(b.options.index, b._i)
};
c.chart = a;
c.options = b = c.setOptions(b);
c.linkedSeries = [];
c.bindAxes();
O(c, {name: b.name, state: "", pointAttr: {}, visible: !1 !== b.visible, selected: !0 === b.selected});
za && (b.animation = !1);
e = b.events;
for (d in e) ga(c, d, e[d]);
if (e && e.click || b.point && b.point.events && b.point.events.click || b.allowPointSelect) a.runTrackerClick = !0;
c.getColor();
c.getSymbol();
t(c.parallelArrays, function (a) {
c[a + "Data"] = []
});
c.setData(b.data, !1);
c.isCartesian && (a.hasCartesianSeries = !0);
f.push(c);
c._i = f.length - 1;
fb(f, g);
this.yAxis && fb(this.yAxis.series, g);
t(f, function (a, b) {
a.index = b;
a.name = a.name || "Series " + (b + 1)
})
},
bindAxes: function () {
var a = this, b = a.options, c = a.chart, d;
t(a.axisTypes || [], function (e) {
t(c[e], function (c) {
d = c.options;
if (b[e] === d.index || b[e] !== J && b[e] === d.id || b[e] === J && 0 === d.index) c.series.push(a), a[e] = c, c.isDirty = !0
});
a[e] || a.optionalAxis === e || L(18, !0)
})
},
updateParallelArrays: function (a, b) {
var c = a.series, d = arguments;
t(c.parallelArrays, "number" === typeof b ? function (d) {
var f = "y" === d && c.toYData ? c.toYData(a) : a[d];
c[d + "Data"][b] = f
} : function (a) {
Array.prototype[b].apply(c[a + "Data"], Array.prototype.slice.call(d, 2))
})
},
autoIncrement: function () {
var a = this.options, b = this.xIncrement, c, d = a.pointIntervalUnit, b = z(b, a.pointStart, 0);
this.pointInterval = c = z(this.pointInterval, a.pointInterval, 1);
if ("month" === d || "year" === d) a = new ya(b), a = "month" === d ? +a[ub](a[Va]() + c) : +a[vb](a[Wa]() + c), c = a - b;
this.xIncrement = b + c;
return b
},
getSegments: function () {
var a = -1, b = [], c, d = this.points, e = d.length;
if (e) if (this.options.connectNulls) {
for (c = e; c--;) null === d[c].y && d.splice(c, 1);
d.length && (b = [d])
} else t(d, function (c, g) {
null === c.y ? (g > a + 1 && b.push(d.slice(a + 1, g)), a = g) : g === e - 1 && b.push(d.slice(a + 1, g + 1))
});
this.segments = b
},
setOptions: function (a) {
var b = this.chart, c = b.options.plotOptions, b = b.userOptions || {}, d = b.plotOptions || {},
e = c[this.type];
this.userOptions = a;
c = A(e, c.series, a);
this.tooltipOptions = A(la.tooltip, la.plotOptions[this.type].tooltip, b.tooltip, d.series && d.series.tooltip, d[this.type] && d[this.type].tooltip, a.tooltip);
null === e.marker && delete c.marker;
this.zoneAxis = c.zoneAxis;
a = this.zones = (c.zones || []).slice();
!c.negativeColor && !c.negativeFillColor || c.zones || a.push({
value: c[this.zoneAxis + "Threshold"] || c.threshold || 0,
color: c.negativeColor,
fillColor: c.negativeFillColor
});
a.length && u(a[a.length - 1].value) && a.push({color: this.color, fillColor: this.fillColor});
return c
},
getCyclic: function (a, b, c) {
var d = this.userOptions, e = "_" + a + "Index", f = a + "Counter";
b || (u(d[e]) ? b = d[e] : (d[e] = b = this.chart[f] % c.length, this.chart[f] += 1), b = c[b]);
this[a] = b
},
getColor: function () {
this.options.colorByPoint ? this.options.color = null : this.getCyclic("color", this.options.color || aa[this.type].color, this.chart.options.colors)
},
getSymbol: function () {
var a = this.options.marker;
this.getCyclic("symbol", a.symbol, this.chart.options.symbols);
/^url/.test(this.symbol) && (a.radius = 0)
},
drawLegendSymbol: cb.drawLineMarker,
setData: function (a, b, c, d) {
var e = this, f = e.points, g = f && f.length || 0, h, k = e.options, l = e.chart, m = null, w = e.xAxis,
y = w && !!w.categories, x = k.turboThreshold, n = this.xData, q = this.yData,
p = (h = e.pointArrayMap) && h.length;
a = a || [];
h = a.length;
b = z(b, !0);
if (!1 !== d && h && g === h && !e.cropped && !e.hasGroupedData && e.visible) t(a, function (a, b) {
f[b].update && a !== k.data[b] && f[b].update(a, !1, null, !1)
}); else {
e.xIncrement = null;
e.colorCounter = 0;
t(this.parallelArrays, function (a) {
e[a + "Data"].length = 0
});
if (x && h > x) {
for (c = 0; null === m && c < h;) m = a[c], c++;
if (r(m)) {
y = z(k.pointStart, 0);
m = z(k.pointInterval, 1);
for (c = 0; c < h; c++) n[c] = y, q[c] = a[c], y += m;
e.xIncrement = y
} else if (ia(m)) if (p) for (c = 0; c < h; c++) m = a[c], n[c] = m[0], q[c] = m.slice(1, p + 1); else for (c = 0; c < h; c++) m = a[c], n[c] = m[0], q[c] = m[1]; else L(12)
} else for (c = 0; c < h; c++) a[c] !== J && (m = {series: e}, e.pointClass.prototype.applyOptions.apply(m, [a[c]]), e.updateParallelArrays(m, c), y && u(m.name) && (w.names[m.x] = m.name));
ha(q[0]) && L(14, !0);
e.data = [];
e.options.data = a;
for (c = g; c--;) f[c] && f[c].destroy && f[c].destroy();
w && (w.minRange = w.userMinRange);
e.isDirty = e.isDirtyData = l.isDirtyBox = !0;
c = !1
}
"point" === k.legendType && (this.processData(), this.generatePoints());
b && l.redraw(c)
},
processData: function (a) {
var b = this.xData, c = this.yData, d = b.length, e;
e = 0;
var f, g, h = this.xAxis, k, l = this.options;
k = l.cropThreshold;
var l = this.getExtremesFromAll || l.getExtremesFromAll, m = this.isCartesian, w, y;
if (m && !this.isDirty && !h.isDirty && !this.yAxis.isDirty && !a) return !1;
h && (a = h.getExtremes(), w = a.min, y = a.max);
if (m && this.sorted && !l && (!k || d > k || this.forceCrop)) if (b[d - 1] < w || b[0] > y) b = [], c = []; else if (b[0] < w || b[d - 1] > y) e = this.cropData(this.xData, this.yData, w, y), b = e.xData, c = e.yData, e = e.start, f = !0;
for (k = b.length - 1; 0 <= k; k--) d = b[k] - b[k - 1], 0 < d && (g === J || d < g) ? g = d : 0 > d && this.requireSorting && L(15);
this.cropped = f;
this.cropStart = e;
this.processedXData = b;
this.processedYData = c;
this.closestPointRange = g
},
cropData: function (a, b, c, d) {
var e = a.length, f = 0, g = e, h = z(this.cropShoulder, 1), k;
for (k = 0; k < e; k++) if (a[k] >= c) {
f = G(0, k - h);
break
}
for (c = k; c < e; c++) if (a[c] > d) {
g = c + h;
break
}
return {xData: a.slice(f, g), yData: b.slice(f, g), start: f, end: g}
},
generatePoints: function () {
var a = this.options.data, b = this.data, c, d = this.processedXData, e = this.processedYData,
f = this.pointClass, g = d.length, h = this.cropStart || 0, k, l = this.hasGroupedData, m, w = [], y;
b || l || (b = [], b.length = a.length, b = this.data = b);
for (y = 0; y < g; y++) k = h + y, l ? w[y] = (new f).init(this, [d[y]].concat(S(e[y]))) : (b[k] ? m = b[k] : a[k] !== J && (b[k] = m = (new f).init(this, a[k], d[y])), w[y] = m), w[y].index = k;
if (b && (g !== (c = b.length) || l)) for (y = 0; y < c; y++) y !== h || l || (y += g), b[y] && (b[y].destroyElements(), b[y].plotX = J);
this.data = b;
this.points = w
},
getExtremes: function (a) {
var b = this.yAxis, c = this.processedXData, d, e = [], f = 0;
d = this.xAxis.getExtremes();
var g = d.min, h = d.max, k, l, m, w;
a = a || this.stackedYData || this.processedYData;
d = a.length;
for (w = 0; w < d; w++) if (l = c[w], m = a[w], k = null !== m && m !== J && (!b.isLog || m.length || 0 < m), l = this.getExtremesFromAll || this.options.getExtremesFromAll || this.cropped || (c[w + 1] || l) >= g && (c[w - 1] || l) <= h, k && l) if (k = m.length) for (; k--;) null !== m[k] && (e[f++] = m[k]); else e[f++] = m;
this.dataMin = D(e);
this.dataMax = Ia(e)
},
translate: function () {
this.processedXData || this.processData();
this.generatePoints();
for (var a = this.options, b = a.stacking, c = this.xAxis, d = c.categories, e = this.yAxis, f = this.points, g = f.length, h = !!this.modifyValue, k = a.pointPlacement, l = "between" === k || r(k), m = a.threshold, w = a.startFromThreshold ? m : 0, y, x, n, q, p = Number.MAX_VALUE, a = 0; a < g; a++) {
var t = f[a], C = t.x, H = t.y;
x = t.low;
var v = b && e.stacks[(this.negStacks && H < (w ? 0 : m) ? "-" : "") + this.stackKey];
e.isLog && null !== H && 0 >= H && (t.y = H = null, L(10));
t.plotX = y = U(G(-1E5, c.translate(C, 0, 0, 0, 1, k, "flags" === this.type)), 1E5);
b && this.visible && v && v[C] && (q = this.getStackIndicator(q, C, this.index), v = v[C], H = v.points[q.key], x = H[0], H = H[1], x === w && (x = z(m, e.min)), e.isLog && 0 >= x && (x = null), t.total = t.stackTotal = v.total, t.percentage = v.total && t.y / v.total * 100, t.stackY = H, v.setOffset(this.pointXOffset || 0, this.barW || 0));
t.yBottom = u(x) ? e.translate(x, 0, 1, 0, 1) : null;
h && (H = this.modifyValue(H, t));
t.plotY = x = "number" === typeof H && Infinity !== H ? U(G(-1E5, e.translate(H, 0, 1, 0, 1)), 1E5) : J;
t.isInside = x !== J && 0 <= x && x <= e.len && 0 <= y && y <= c.len;
t.clientX = l ? c.translate(C, 0, 0, 0, 1) : y;
t.negative = t.y < (m || 0);
t.category = d && d[t.x] !== J ? d[t.x] : t.x;
a && (p = U(p, fa(y - n)));
n = y
}
this.closestPointRangePx = p;
this.getSegments()
},
setClip: function (a) {
var b = this.chart, c = this.options, d = b.renderer, e = b.inverted, f = this.clipBox, g = f || b.clipBox,
h = this.sharedClipKey || ["_sharedClip", a && a.duration, a && a.easing, g.height, c.xAxis, c.yAxis].join(),
k = b[h], l = b[h + "m"];
k || (a && (g.width = 0, b[h + "m"] = l = d.clipRect(-99, e ? -b.plotLeft : -b.plotTop, 99, e ? b.chartWidth : b.chartHeight)), b[h] = k = d.clipRect(g));
a && (k.count += 1);
!1 !== c.clip && (this.group.clip(a || f ? k : b.clipRect), this.markerGroup.clip(l), this.sharedClipKey = h);
a || (--k.count, 0 >= k.count && h && b[h] && (f || (b[h] = b[h].destroy()), b[h + "m"] && (b[h + "m"] = b[h + "m"].destroy())))
},
animate: function (a) {
var b = this.chart, c = this.options.animation, d;
c && !W(c) && (c = aa[this.type].animation);
a ? this.setClip(c) : (d = this.sharedClipKey, (a = b[d]) && a.animate({width: b.plotSizeX}, c), b[d + "m"] && b[d + "m"].animate({width: b.plotSizeX + 99}, c), this.animate = null)
},
afterAnimate: function () {
this.setClip();
da(this, "afterAnimate")
},
drawPoints: function () {
var a, b = this.points, c = this.chart, d, e, f, g, h, k, l, m, w = this.options.marker,
y = this.pointAttr[""], x, n, q, t = this.markerGroup,
r = z(w.enabled, this.xAxis.isRadial, this.closestPointRangePx > 2 * w.radius);
if (!1 !== w.enabled || this._hasPointMarkers) for (f = b.length; f--;) g = b[f], d = ea(g.plotX), e = g.plotY, m = g.graphic, x = g.marker || {}, n = !!g.marker, a = r && x.enabled === J || x.enabled, q = g.isInside, a && e !== J && !isNaN(e) && null !== g.y ? (a = g.pointAttr[g.selected ? "select" : ""] || y, h = a.r, k = z(x.symbol, this.symbol), l = 0 === k.indexOf("url"), m ? m[q ? "show" : "hide"](!0).animate(O({
x: d - h,
y: e - h
}, m.symbolName ? {
width: 2 * h,
height: 2 * h
} : {})) : q && (0 < h || l) && (g.graphic = c.renderer.symbol(k, d - h, e - h, 2 * h, 2 * h, n ? x : w).attr(a).add(t))) : m && (g.graphic = m.destroy())
},
convertAttribs: function (a, b, c, d) {
var e = this.pointAttrToOptions, f, g, h = {};
a = a || {};
b = b || {};
c = c || {};
d = d || {};
for (f in e) g = e[f], h[f] = z(a[g], b[f], c[f], d[f]);
return h
},
getAttribs: function () {
var a = this, b = a.options, c = aa[a.type].marker ? b.marker : b, d = c.states, e = d.hover, f,
g = a.color, h = a.options.negativeColor;
f = {stroke: g, fill: g};
var k = a.points || [], l, m, w = [], y = a.pointAttrToOptions;
l = a.hasPointSpecificOptions;
var x = c.lineColor, n = c.fillColor;
m = b.turboThreshold;
var q = a.zones, r = a.zoneAxis || "y", p;
b.marker ? (e.radius = e.radius || c.radius + e.radiusPlus, e.lineWidth = e.lineWidth || c.lineWidth + e.lineWidthPlus) : (e.color = e.color || pa(e.color || g).brighten(e.brightness).get(), e.negativeColor = e.negativeColor || pa(e.negativeColor || h).brighten(e.brightness).get());
w[""] = a.convertAttribs(c, f);
t(["hover", "select"], function (b) {
w[b] = a.convertAttribs(d[b], w[""])
});
a.pointAttr = w;
g = k.length;
if (!m || g < m || l) for (; g--;) {
m = k[g];
(c = m.options && m.options.marker || m.options) && !1 === c.enabled && (c.radius = 0);
if (q.length) {
l = 0;
for (f = q[l]; m[r] >= f.value;) f = q[++l];
m.color = m.fillColor = z(f.color, a.color)
}
l = b.colorByPoint || m.color;
if (m.options) for (p in y) u(c[y[p]]) && (l = !0);
if (l) {
c = c || {};
l = [];
d = c.states || {};
f = d.hover = d.hover || {};
if (!b.marker || m.negative && !f.fillColor && !e.fillColor) f[a.pointAttrToOptions.fill] = f.color || !m.options.color && e[m.negative && h ? "negativeColor" : "color"] || pa(m.color).brighten(f.brightness || e.brightness).get();
f = {color: m.color};
n || (f.fillColor = m.color);
x || (f.lineColor = m.color);
c.hasOwnProperty("color") && !c.color && delete c.color;
l[""] = a.convertAttribs(O(f, c), w[""]);
l.hover = a.convertAttribs(d.hover, w.hover, l[""]);
l.select = a.convertAttribs(d.select, w.select, l[""])
} else l = w;
m.pointAttr = l
}
},
destroy: function () {
var a = this, b = a.chart, c = /AppleWebKit\/533/.test(Ja), d, e = a.data || [], f, g, h;
da(a, "destroy");
ma(a);
t(a.axisTypes || [], function (b) {
if (h = a[b]) M(h.series, a), h.isDirty = h.forceRedraw = !0
});
a.legendItem && a.chart.legend.destroyItem(a);
for (d = e.length; d--;) (f = e[d]) && f.destroy && f.destroy();
a.points = null;
clearTimeout(a.animationTimeout);
for (g in a) a[g] instanceof ja && !a[g].survive && (d = c && "group" === g ? "hide" : "destroy", a[g][d]());
b.hoverSeries === a && (b.hoverSeries = null);
M(b.series, a);
for (g in a) delete a[g]
},
getSegmentPath: function (a) {
var b = this, c = [], d = b.options.step;
t(a, function (e, f) {
var g = e.plotX, h = e.plotY, k;
b.getPointSpline ? c.push.apply(c, b.getPointSpline(a, e, f)) : (c.push(f ? "L" : "M"), d && f && (k = a[f - 1], "right" === d ? c.push(k.plotX, h, "L") : "center" === d ? c.push((k.plotX + g) / 2, k.plotY, "L", (k.plotX + g) / 2, h, "L") : c.push(g, k.plotY, "L")), c.push(e.plotX, e.plotY))
});
return c
},
getGraphPath: function () {
var a = this, b = [], c, d = [];
t(a.segments, function (e) {
c = a.getSegmentPath(e);
1 < e.length ? b = b.concat(c) : d.push(e[0])
});
a.singlePoints = d;
return a.graphPath = b
},
drawGraph: function () {
var a = this, b = this.options, c = [["graph", b.lineColor || this.color, b.dashStyle]], d = b.lineWidth,
e = "square" !== b.linecap, f = this.getGraphPath(), g = this.fillGraph && this.color || "none";
t(this.zones, function (d, e) {
c.push(["zoneGraph" + e, d.color || a.color, d.dashStyle || b.dashStyle])
});
t(c, function (c, k) {
var l = c[0], m = a[l];
m ? m.animate({d: f}) : (d || g) && f.length && (m = {
stroke: c[1],
"stroke-width": d,
fill: g,
zIndex: 1
}, c[2] ? m.dashstyle = c[2] : e && (m["stroke-linecap"] = m["stroke-linejoin"] = "round"), a[l] = a.chart.renderer.path(f).attr(m).add(a.group).shadow(2 > k && b.shadow))
})
},
applyZones: function () {
var a = this, b = this.chart, c = b.renderer, d = this.zones, e, f, g = this.clips || [], h, k = this.graph,
l = this.area, m = G(b.chartWidth, b.chartHeight), w = this[(this.zoneAxis || "y") + "Axis"], y,
x = w.reversed, n = b.inverted, q = w.horiz, r, p, u, C = !1;
d.length && (k || l) && w.min !== J && (k && k.hide(), l && l.hide(), y = w.getExtremes(), t(d, function (d, t) {
e = x ? q ? b.plotWidth : 0 : q ? 0 : w.toPixels(y.min);
e = U(G(z(f, e), 0), m);
f = U(G(R(w.toPixels(z(d.value, y.max), !0)), 0), m);
C && (e = f = w.toPixels(y.max));
r = Math.abs(e - f);
p = U(e, f);
u = G(e, f);
w.isXAxis ? (h = {
x: n ? u : p,
y: 0,
width: r,
height: m
}, q || (h.x = b.plotHeight - h.x)) : (h = {
x: 0,
y: n ? u : p,
width: m,
height: r
}, q && (h.y = b.plotWidth - h.y));
b.inverted && c.isVML && (h = w.isXAxis ? {
x: 0,
y: x ? p : u,
height: h.width,
width: b.chartWidth
} : {x: h.y - b.plotLeft - b.spacingBox.x, y: 0, width: h.height, height: b.chartHeight});
g[t] ? g[t].animate(h) : (g[t] = c.clipRect(h), k && a["zoneGraph" + t].clip(g[t]), l && a["zoneArea" + t].clip(g[t]));
C = d.value > y.max
}), this.clips = g)
},
invertGroups: function () {
function a() {
var a = {width: b.yAxis.len, height: b.xAxis.len};
t(["group", "markerGroup"], function (c) {
b[c] && b[c].attr(a).invert()
})
}
var b = this, c = b.chart;
b.xAxis && (ga(c, "resize", a), ga(b, "destroy", function () {
ma(c, "resize", a)
}), a(), b.invertGroups = a)
},
plotGroup: function (a, b, c, d, e) {
var f = this[a], g = !f;
g && (this[a] = f = this.chart.renderer.g(b).attr({zIndex: d || .1}).add(e), f.addClass("highcharts-series-" + this.index));
f.attr({visibility: c})[g ? "attr" : "animate"](this.getPlotBox());
return f
},
getPlotBox: function () {
var a = this.chart, b = this.xAxis, c = this.yAxis;
a.inverted && (b = c, c = this.xAxis);
return {translateX: b ? b.left : a.plotLeft, translateY: c ? c.top : a.plotTop, scaleX: 1, scaleY: 1}
},
render: function () {
var a = this, b = a.chart, c, d = a.options,
e = (c = d.animation) && !!a.animate && b.renderer.isSVG && z(c.duration, 500) || 0,
f = a.visible ? "inherit" : "hidden", g = d.zIndex, h = a.hasRendered, k = b.seriesGroup;
c = a.plotGroup("group", "series", f, g, k);
a.markerGroup = a.plotGroup("markerGroup", "markers", f, g, k);
e && a.animate(!0);
a.getAttribs();
c.inverted = a.isCartesian ? b.inverted : !1;
a.drawGraph && (a.drawGraph(), a.applyZones());
t(a.points, function (a) {
a.redraw && a.redraw()
});
a.drawDataLabels && a.drawDataLabels();
a.visible && a.drawPoints();
a.drawTracker && !1 !== a.options.enableMouseTracking && a.drawTracker();
b.inverted && a.invertGroups();
!1 === d.clip || a.sharedClipKey || h || c.clip(b.clipRect);
e && a.animate();
h || (a.animationTimeout = oa(function () {
a.afterAnimate()
}, e));
a.isDirty = a.isDirtyData = !1;
a.hasRendered = !0
},
redraw: function () {
var a = this.chart, b = this.isDirtyData, c = this.isDirty, d = this.group, e = this.xAxis, f = this.yAxis;
d && (a.inverted && d.attr({
width: a.plotWidth,
height: a.plotHeight
}), d.animate({translateX: z(e && e.left, a.plotLeft), translateY: z(f && f.top, a.plotTop)}));
this.translate();
this.render();
b && da(this, "updatedData");
(c || b) && delete this.kdTree
},
kdDimensions: 1,
kdAxisArray: ["clientX", "plotY"],
searchPoint: function (a, b) {
var c = this.xAxis, d = this.yAxis, e = this.chart.inverted;
return this.searchKDTree({
clientX: e ? c.len - a.chartY + c.pos : a.chartX - c.pos,
plotY: e ? d.len - a.chartX + d.pos : a.chartY - d.pos
}, b)
},
buildKDTree: function () {
function a(c, e, f) {
var g, h;
if (h = c && c.length) return g = b.kdAxisArray[e % f], c.sort(function (a, b) {
return a[g] - b[g]
}), h = Math.floor(h / 2), {
point: c[h],
left: a(c.slice(0, h), e + 1, f),
right: a(c.slice(h + 1), e + 1, f)
}
}
var b = this, c = b.kdDimensions;
delete b.kdTree;
oa(function () {
var d = Na(b.points || [], function (a) {
return null !== a.y
});
b.kdTree = a(d, c, c)
}, b.options.kdNow ? 0 : 1)
},
searchKDTree: function (a, b) {
function c(a, b, l, m) {
var w = b.point, y = d.kdAxisArray[l % m], x, n, q = w;
n = u(a[e]) && u(w[e]) ? Math.pow(a[e] - w[e], 2) : null;
x = u(a[f]) && u(w[f]) ? Math.pow(a[f] - w[f], 2) : null;
x = (n || 0) + (x || 0);
w.dist = u(x) ? Math.sqrt(x) : Number.MAX_VALUE;
w.distX = u(n) ? Math.sqrt(n) : Number.MAX_VALUE;
y = a[y] - w[y];
x = 0 > y ? "left" : "right";
n = 0 > y ? "right" : "left";
b[x] && (x = c(a, b[x], l + 1, m), q = x[g] < q[g] ? x : w);
b[n] && Math.sqrt(y * y) < q[g] && (a = c(a, b[n], l + 1, m), q = a[g] < q[g] ? a : q);
return q
}
var d = this, e = this.kdAxisArray[0], f = this.kdAxisArray[1], g = b ? "distX" : "dist";
this.kdTree || this.buildKDTree();
if (this.kdTree) return c(a, this.kdTree, this.kdDimensions, this.kdDimensions)
}
};
Xa.prototype = {
destroy: function () {
Qa(this, this.axis)
}, render: function (a) {
var b = this.options, c = b.format, c = c ? X(c, this) : b.formatter.call(this);
this.label ? this.label.attr({
text: c,
visibility: "hidden"
}) : this.label = this.axis.chart.renderer.text(c, null, null, b.useHTML).css(b.style).attr({
align: this.textAlign,
rotation: b.rotation,
visibility: "hidden"
}).add(a)
}, setOffset: function (a, b) {
var c = this.axis, d = c.chart, e = d.inverted, f = c.reversed,
f = this.isNegative && !f || !this.isNegative && f,
g = c.translate(c.usePercentage ? 100 : this.total, 0, 0, 0, 1), c = c.translate(0), c = fa(g - c),
h = d.xAxis[0].translate(this.x) + a, k = d.plotHeight, f = {
x: e ? f ? g : g - c : h,
y: e ? k - h - b : f ? k - g - c : k - g,
width: e ? c : b,
height: e ? b : c
};
if (e = this.label) e.align(this.alignOptions, null, f), f = e.alignAttr, e[!1 === this.options.crop || d.isInsidePlot(f.x, f.y) ? "show" : "hide"](!0)
}
};
db.prototype.getStacks = function () {
var a = this;
t(a.yAxis, function (a) {
a.stacks && a.hasVisibleSeries && (a.oldStacks = a.stacks)
});
t(a.series, function (b) {
!b.options.stacking || !0 !== b.visible && !1 !== a.options.chart.ignoreHiddenSeries || (b.stackKey = b.type + z(b.options.stack, ""))
})
};
wa.prototype.buildStacks = function () {
var a = this.series, b = z(this.options.reversedStacks, !0), c = a.length;
if (!this.isXAxis) {
for (this.usePercentage = !1; c--;) a[b ? c : a.length - c - 1].setStackedPoints();
if (this.usePercentage) for (c = 0; c < a.length; c++) a[c].setPercentStacks()
}
};
wa.prototype.renderStackTotals = function () {
var a = this.chart, b = a.renderer, c = this.stacks, d, e, f = this.stackTotalGroup;
f || (this.stackTotalGroup = f = b.g("stack-labels").attr({visibility: "visible", zIndex: 6}).add());
f.translate(a.plotLeft, a.plotTop);
for (d in c) for (e in a = c[d], a) a[e].render(f)
};
wa.prototype.resetStacks = function () {
var a = this.stacks, b, c;
if (!this.isXAxis) for (b in a) for (c in a[b]) a[b][c].touched < this.stacksTouched ? (a[b][c].destroy(), delete a[b][c]) : (a[b][c].total = null, a[b][c].cum = 0)
};
wa.prototype.cleanStacks = function () {
var a, b, c;
if (!this.isXAxis) for (b in this.oldStacks && (a = this.stacks = this.oldStacks), a) for (c in a[b]) a[b][c].cum = a[b][c].total
};
Y.prototype.setStackedPoints = function () {
if (this.options.stacking && (!0 === this.visible || !1 === this.chart.options.chart.ignoreHiddenSeries)) {
var a = this.processedXData, b = this.processedYData, c = [], d = b.length, e = this.options,
f = e.threshold, g = e.startFromThreshold ? f : 0, h = e.stack, e = e.stacking, k = this.stackKey,
l = "-" + k, m = this.negStacks, w = this.yAxis, y = w.stacks, x = w.oldStacks, n, q, t, r, p, u, C;
w.stacksTouched += 1;
for (p = 0; p < d; p++) u = a[p], C = b[p], n = this.getStackIndicator(n, u, this.index), r = n.key, t = (q = m && C < (g ? 0 : f)) ? l : k, y[t] || (y[t] = {}), y[t][u] || (x[t] && x[t][u] ? (y[t][u] = x[t][u], y[t][u].total = null) : y[t][u] = new Xa(w, w.options.stackLabels, q, u, h)), t = y[t][u], t.points[r] = [z(t.cum, g)], t.touched = w.stacksTouched, 0 < n.index && !1 === this.singleStacks && (t.points[r][0] = t.points[this.index + "," + u + ",0"][0]), "percent" === e ? (q = q ? k : l, m && y[q] && y[q][u] ? (q = y[q][u], t.total = q.total = G(q.total, t.total) + fa(C) || 0) : t.total = ua(t.total + (fa(C) || 0))) : t.total = ua(t.total + (C || 0)), t.cum = z(t.cum, g) + (C || 0), t.points[r].push(t.cum), c[p] = t.cum;
"percent" === e && (w.usePercentage = !0);
this.stackedYData = c;
w.oldStacks = {}
}
};
Y.prototype.setPercentStacks = function () {
var a = this, b = a.stackKey, c = a.yAxis.stacks, d = a.processedXData, e;
t([b, "-" + b], function (b) {
for (var g = d.length, h, k; g--;) if (h = d[g], e = a.getStackIndicator(e, h, a.index), h = (k = c[b] && c[b][h]) && k.points[e.key]) k = k.total ? 100 / k.total : 0, h[0] = ua(h[0] * k), h[1] = ua(h[1] * k), a.stackedYData[g] = h[1]
})
};
Y.prototype.getStackIndicator = function (a, b, c) {
u(a) && a.x === b ? a.index++ : a = {x: b, index: 0};
a.key = [c, b, a.index].join();
return a
};
O(db.prototype, {
addSeries: function (a, b, c) {
var d, e = this;
a && (b = z(b, !0), da(e, "addSeries", {options: a}, function () {
d = e.initSeries(a);
e.isDirtyLegend = !0;
e.linkSeries();
b && e.redraw(c)
}));
return d
}, addAxis: function (a, b, c, d) {
var e = b ? "xAxis" : "yAxis", f = this.options;
new wa(this, A(a, {index: this[e].length, isX: b}));
f[e] = S(f[e] || {});
f[e].push(a);
z(c, !0) && this.redraw(d)
}, showLoading: function (a) {
var b = this, c = b.options, d = b.loadingDiv, e = c.loading, f = function () {
d && E(d, {
left: b.plotLeft + "px",
top: b.plotTop + "px",
width: b.plotWidth + "px",
height: b.plotHeight + "px"
})
};
d || (b.loadingDiv = d = ca("div", {className: "highcharts-loading"}, O(e.style, {
zIndex: 10,
display: "none"
}), b.container), b.loadingSpan = ca("span", null, e.labelStyle, d), ga(b, "redraw", f));
b.loadingSpan.innerHTML = a || c.lang.loading;
b.loadingShown || (E(d, {
opacity: 0,
display: ""
}), Sa(d, {opacity: e.style.opacity}, {duration: e.showDuration || 0}), b.loadingShown = !0);
f()
}, hideLoading: function () {
var a = this.options, b = this.loadingDiv;
b && Sa(b, {opacity: 0}, {
duration: a.loading.hideDuration || 100, complete: function () {
E(b, {display: "none"})
}
});
this.loadingShown = !1
}
});
O(Ga.prototype, {
update: function (a, b, c, d) {
function e() {
f.applyOptions(a);
null === f.y && h && (f.graphic = h.destroy());
W(a) && !ia(a) && (f.redraw = function () {
h && h.element && a && a.marker && a.marker.symbol && (f.graphic = h.destroy());
a && a.dataLabels && f.dataLabel && (f.dataLabel = f.dataLabel.destroy());
f.redraw = null
});
k = f.index;
g.updateParallelArrays(f, k);
w && f.name && (w[f.x] = f.name);
m.data[k] = W(m.data[k]) ? f.options : a;
g.isDirty = g.isDirtyData = !0;
!g.fixedBox && g.hasCartesianSeries && (l.isDirtyBox = !0);
"point" === m.legendType && (l.isDirtyLegend = !0);
b && l.redraw(c)
}
var f = this, g = f.series, h = f.graphic, k, l = g.chart, m = g.options, w = g.xAxis && g.xAxis.names;
b = z(b, !0);
!1 === d ? e() : f.firePointEvent("update", {options: a}, e)
}, remove: function (a, b) {
this.series.removePoint(Aa(this, this.series.data), a, b)
}
});
O(Y.prototype, {
addPoint: function (a, b, c, d) {
var e = this, f = e.options, g = e.data, h = e.graph, k = e.area, l = e.chart, m = e.xAxis && e.xAxis.names,
w = h && h.shift || 0, y = ["graph", "area"], h = f.data, x, n = e.xData;
Ra(d, l);
if (c) {
for (d = e.zones.length; d--;) y.push("zoneGraph" + d, "zoneArea" + d);
t(y, function (a) {
e[a] && (e[a].shift = w + (f.step ? 2 : 1))
})
}
k && (k.isArea = !0);
b = z(b, !0);
k = {series: e};
e.pointClass.prototype.applyOptions.apply(k, [a]);
y = k.x;
d = n.length;
if (e.requireSorting && y < n[d - 1]) for (x = !0; d && n[d - 1] > y;) d--;
e.updateParallelArrays(k, "splice", d, 0, 0);
e.updateParallelArrays(k, d);
m && k.name && (m[y] = k.name);
h.splice(d, 0, a);
x && (e.data.splice(d, 0, null), e.processData());
"point" === f.legendType && e.generatePoints();
c && (g[0] && g[0].remove ? g[0].remove(!1) : (g.shift(), e.updateParallelArrays(k, "shift"), h.shift()));
e.isDirty = !0;
e.isDirtyData = !0;
b && (e.getAttribs(), l.redraw())
}, removePoint: function (a, b, c) {
var d = this, e = d.data, f = e[a], g = d.points, h = d.chart, k = function () {
e.length === g.length && g.splice(a, 1);
e.splice(a, 1);
d.options.data.splice(a, 1);
d.updateParallelArrays(f || {series: d}, "splice", a, 1);
f && f.destroy();
d.isDirty = !0;
d.isDirtyData = !0;
b && h.redraw()
};
Ra(c, h);
b = z(b, !0);
f ? f.firePointEvent("remove", null, k) : k()
}, remove: function (a, b) {
var c = this, d = c.chart;
da(c, "remove", null, function () {
c.destroy();
d.isDirtyLegend = d.isDirtyBox = !0;
d.linkSeries();
z(a, !0) && d.redraw(b)
})
}, update: function (a, b) {
var c = this, d = this.chart, e = this.userOptions, f = this.type, g = K[f].prototype,
h = ["group", "markerGroup", "dataLabelsGroup"], k;
if (a.type && a.type !== f || void 0 !== a.zIndex) h.length = 0;
t(h, function (a) {
h[a] = c[a];
delete c[a]
});
a = A(e, {animation: !1, index: this.index, pointStart: this.xData[0]}, {data: this.options.data}, a);
this.remove(!1);
for (k in g) this[k] = J;
O(this, K[a.type || f].prototype);
t(h, function (a) {
c[a] = h[a]
});
this.init(d, a);
d.linkSeries();
z(b, !0) && d.redraw(!1)
}
});
O(wa.prototype, {
update: function (a, b) {
var c = this.chart;
a = c.options[this.coll][this.options.index] = A(this.userOptions, a);
this.destroy(!0);
this._addedPlotLB = this.chart._labelPanes = J;
this.init(c, O(a, {events: J}));
c.isDirtyBox = !0;
z(b, !0) && c.redraw()
}, remove: function (a) {
for (var b = this.chart, c = this.coll, d = this.series, e = d.length; e--;) d[e] && d[e].remove(!1);
M(b.axes, this);
M(b[c], this);
b.options[c].splice(this.options.index, 1);
t(b[c], function (a, b) {
a.options.index = b
});
this.destroy();
b.isDirtyBox = !0;
z(a, !0) && b.redraw()
}, setTitle: function (a, b) {
this.update({title: a}, b)
}, setCategories: function (a, b) {
this.update({categories: a}, b)
}
});
var Ub = C(Y);
K.line = Ub;
aa.area = A(bb, {softThreshold: !1, threshold: 0});
var Nb = C(Y, {
type: "area", singleStacks: !1, getSegments: function () {
var a = this, b = [], c = [], d = [], e = this.xAxis, f = this.yAxis, g = f.stacks[this.stackKey], h = {},
k, l, m = this.points, w = this.options.connectNulls, y, x, n;
if (this.options.stacking && !this.cropped) {
for (x = 0; x < m.length; x++) h[m[x].x] = m[x];
for (n in g) null !== g[n].total && d.push(+n);
d.sort(function (a, b) {
return a - b
});
t(d, function (b) {
var d = null, m;
if (!w || h[b] && null !== h[b].y) if (h[b]) c.push(h[b]); else {
for (x = a.index; x <= f.series.length; x++) if (y = a.getStackIndicator(null, b, x), m = g[b].points[y.key]) {
d = m[1];
break
}
k = e.translate(b);
l = f.getThreshold(d);
c.push({y: null, plotX: k, clientX: k, plotY: l, yBottom: l, onMouseOver: ka})
}
});
c.length && b.push(c)
} else Y.prototype.getSegments.call(this), b = this.segments;
this.segments = b
}, getSegmentPath: function (a) {
var b = Y.prototype.getSegmentPath.call(this, a), c = [].concat(b), d, e = this.options;
d = b.length;
var f = this.yAxis.getThreshold(e.threshold), g;
3 === d && c.push("L", b[1], b[2]);
if (e.stacking && !this.closedStacks) for (d = a.length - 1; 0 <= d; d--) g = z(a[d].yBottom, f), d < a.length - 1 && e.step && c.push(a[d + 1].plotX, g), c.push(a[d].plotX, g); else this.closeSegment(c, a, f);
this.areaPath = this.areaPath.concat(c);
return b
}, closeSegment: function (a, b, c) {
a.push("L", b[b.length - 1].plotX, c, "L", b[0].plotX, c)
}, drawGraph: function () {
this.areaPath = [];
Y.prototype.drawGraph.apply(this);
var a = this, b = this.areaPath, c = this.options, d = [["area", this.color, c.fillColor]];
t(this.zones, function (b, f) {
d.push(["zoneArea" + f, b.color || a.color, b.fillColor || c.fillColor])
});
t(d, function (d) {
var f = d[0], g = a[f];
g ? g.animate({d: b}) : (g = {
fill: d[2] || d[1],
zIndex: 0
}, d[2] || (g["fill-opacity"] = c.fillOpacity || .75), a[f] = a.chart.renderer.path(b).attr(g).add(a.group))
})
}, drawLegendSymbol: cb.drawRectangle
});
K.area = Nb;
aa.spline = A(bb);
var Ob = C(Y, {
type: "spline", getPointSpline: function (a, b, c) {
var d = b.plotX, e = b.plotY, f = a[c -
1], g = a[c + 1], h, k, l, m;
if (f && g) {
a = f.plotY;
l = g.plotX;
var g = g.plotY, w;
h = (1.5 * d + f.plotX) / 2.5;
k = (1.5 * e + a) / 2.5;
l = (1.5 * d + l) / 2.5;
m = (1.5 * e + g) / 2.5;
w = (m - k) * (l - d) / (l - h) + e - m;
k += w;
m += w;
k > a && k > e ? (k = G(a, e), m = 2 * e - k) : k < a && k < e && (k = U(a, e), m = 2 * e - k);
m > g && m > e ? (m = G(g, e), k = 2 * e - m) : m < g && m < e && (m = U(g, e), k = 2 * e - m);
b.rightContX = l;
b.rightContY = m
}
c ? (b = ["C", f.rightContX || f.plotX, f.rightContY || f.plotY, h || d, k || e, d, e], f.rightContX = f.rightContY = null) : b = ["M", d, e];
return b
}
});
K.spline = Ob;
aa.areaspline = A(aa.area);
var zb = Nb.prototype, Vb = C(Ob, {
type: "areaspline",
closedStacks: !0,
getSegmentPath: zb.getSegmentPath,
closeSegment: zb.closeSegment,
drawGraph: zb.drawGraph,
drawLegendSymbol: cb.drawRectangle
});
K.areaspline = Vb;
aa.column = A(bb, {
borderColor: "#FFFFFF",
borderRadius: 0,
groupPadding: .2,
marker: null,
pointPadding: .1,
minPointLength: 0,
cropThreshold: 50,
pointRange: null,
states: {
hover: {brightness: .1, shadow: !1, halo: !1},
select: {color: "#C0C0C0", borderColor: "#000000", shadow: !1}
},
dataLabels: {align: null, verticalAlign: null, y: null},
softThreshold: !1,
startFromThreshold: !0,
stickyTracking: !1,
tooltip: {distance: 6},
threshold: 0
});
var Ab = C(Y, {
type: "column",
pointAttrToOptions: {stroke: "borderColor", fill: "color", r: "borderRadius"},
cropShoulder: 0,
directTouch: !0,
trackerGroups: ["group", "dataLabelsGroup"],
negStacks: !0,
init: function () {
Y.prototype.init.apply(this, arguments);
var a = this, b = a.chart;
b.hasRendered && t(b.series, function (b) {
b.type === a.type && (b.isDirty = !0)
})
},
getColumnMetrics: function () {
var a = this, b = a.options, c = a.xAxis, d = a.yAxis, e = c.reversed, f, g = {}, h = 0;
!1 === b.grouping ? h = 1 : t(a.chart.series, function (b) {
var c = b.options, e = b.yAxis, k;
b.type === a.type && b.visible && d.len === e.len && d.pos === e.pos && (c.stacking ? (f = b.stackKey, g[f] === J && (g[f] = h++), k = g[f]) : !1 !== c.grouping && (k = h++), b.columnIndex = k)
});
var k = U(fa(c.transA) * (c.ordinalSlope || b.pointRange || c.closestPointRange || c.tickInterval || 1), c.len),
l = k * b.groupPadding, m = (k - 2 * l) / h,
b = U(b.maxPointWidth || c.len, z(b.pointWidth, m * (1 - 2 * b.pointPadding)));
a.columnMetrics = {
width: b,
offset: (m - b) / 2 + (l + ((a.columnIndex || 0) + (e ? 1 : 0)) * m - k / 2) * (e ? -1 : 1)
};
return a.columnMetrics
},
crispCol: function (a, b, c, d) {
var e = this.chart, f = this.borderWidth, g = -(f % 2 ? .5 : 0), f = f % 2 ? .5 : 1;
e.inverted && e.renderer.isVML && (f += 1);
c = Math.round(a + c) + g;
a = Math.round(a) + g;
c -= a;
d = Math.round(b + d) + f;
g = .5 >= fa(b) && .5 < d;
b = Math.round(b) + f;
d -= b;
g && (--b, d += 1);
return {x: a, y: b, width: c, height: d}
},
translate: function () {
var a = this, b = a.chart, c = a.options,
d = a.borderWidth = z(c.borderWidth, 2 > a.closestPointRange * a.xAxis.transA ? 0 : 1), e = a.yAxis,
f = a.translatedThreshold = e.getThreshold(c.threshold), g = z(c.minPointLength, 5),
h = a.getColumnMetrics(), k = h.width, l = a.barW = G(k, 1 + 2 * d), m = a.pointXOffset = h.offset;
b.inverted && (f -= .5);
c.pointPadding && (l = Ba(l));
Y.prototype.translate.apply(a);
t(a.points, function (c) {
var d = U(z(c.yBottom, f), 9E4), h = 999 + fa(d), h = U(G(-h, c.plotY), e.len + h), n = c.plotX + m,
q = l, t = U(h, d), r, p = G(h, d) - t;
fa(p) < g && g && (p = g, r = !e.reversed && !c.negative || e.reversed && c.negative, t = fa(t - f) > g ? d - g : f - (r ? g : 0));
c.barX = n;
c.pointWidth = k;
c.tooltipPos = b.inverted ? [e.len + e.pos - b.plotLeft - h, a.xAxis.len - n - q / 2, p] : [n + q / 2, h + e.pos - b.plotTop, p];
c.shapeType = "rect";
c.shapeArgs = a.crispCol(n, t, q, p)
})
},
getSymbol: ka,
drawLegendSymbol: cb.drawRectangle,
drawGraph: ka,
drawPoints: function () {
var a = this, b = this.chart, c = a.options, d = b.renderer, e = c.animationLimit || 250, f, g;
t(a.points, function (h) {
var k = h.plotY, l = h.graphic;
k === J || isNaN(k) || null === h.y ? l && (h.graphic = l.destroy()) : (f = h.shapeArgs, k = u(a.borderWidth) ? {"stroke-width": a.borderWidth} : {}, g = h.pointAttr[h.selected ? "select" : ""] || a.pointAttr[""], l ? (Oa(l), l.attr(k).attr(g)[b.pointCount < e ? "animate" : "attr"](A(f))) : h.graphic = d[h.shapeType](f).attr(k).attr(g).add(h.group || a.group).shadow(c.shadow, null, c.stacking && !c.borderRadius))
})
},
animate: function (a) {
var b = this.yAxis, c = this.options, d = this.chart.inverted, e = {};
sa && (a ? (e.scaleY = .001, a = U(b.pos + b.len, G(b.pos, b.toPixels(c.threshold))), d ? e.translateX = a - b.len : e.translateY = a, this.group.attr(e)) : (e.scaleY = 1, e[d ? "translateX" : "translateY"] = b.pos, this.group.animate(e, this.options.animation), this.animate = null))
},
remove: function () {
var a = this, b = a.chart;
b.hasRendered && t(b.series, function (b) {
b.type === a.type && (b.isDirty = !0)
});
Y.prototype.remove.apply(a, arguments)
}
});
K.column = Ab;
aa.bar = A(aa.column);
var Wb = C(Ab, {type: "bar", inverted: !0});
K.bar = Wb;
aa.scatter = A(bb, {
lineWidth: 0,
marker: {enabled: !0},
tooltip: {
headerFormat: '\u25cf {series.name} ',
pointFormat: "x: {point.x} y: {point.y} "
}
});
var Pb = C(Y, {
type: "scatter",
sorted: !1,
requireSorting: !1,
noSharedTooltip: !0,
trackerGroups: ["group", "markerGroup", "dataLabelsGroup"],
takeOrdinalPosition: !1,
kdDimensions: 2,
drawGraph: function () {
this.options.lineWidth && Y.prototype.drawGraph.call(this)
}
});
K.scatter = Pb;
aa.pie = A(bb, {
borderColor: "#FFFFFF",
borderWidth: 1,
center: [null, null],
clip: !1,
colorByPoint: !0,
dataLabels: {
distance: 30, enabled: !0, formatter: function () {
return null === this.y ? void 0 : this.point.name
}, x: 0
},
ignoreHiddenPoint: !0,
legendType: "point",
marker: null,
size: null,
showInLegend: !1,
slicedOffset: 10,
states: {hover: {brightness: .1, shadow: !1}},
stickyTracking: !1,
tooltip: {followPointer: !0}
});
var Bb = {
type: "pie",
isCartesian: !1,
pointClass: C(Ga, {
init: function () {
Ga.prototype.init.apply(this, arguments);
var a = this, b;
a.name = z(a.name, "Slice");
b = function (b) {
a.slice("select" === b.type)
};
ga(a, "select", b);
ga(a, "unselect", b);
return a
}, setVisible: function (a, b) {
var c = this, d = c.series, e = d.chart, f = d.options.ignoreHiddenPoint;
b = z(b, f);
a !== c.visible && (c.visible = c.options.visible = a = a === J ? !c.visible : a, d.options.data[Aa(c, d.data)] = c.options, t(["graphic", "dataLabel", "connector", "shadowGroup"], function (b) {
if (c[b]) c[b][a ? "show" : "hide"](!0)
}), c.legendItem && e.legend.colorizeItem(c, a), a || "hover" !== c.state || c.setState(""), f && (d.isDirty = !0), b && e.redraw())
}, slice: function (a, b, c) {
var d = this.series;
Ra(c, d.chart);
z(b, !0);
this.sliced = this.options.sliced = a = u(a) ? a : !this.sliced;
d.options.data[Aa(this, d.data)] = this.options;
a = a ? this.slicedTranslation : {translateX: 0, translateY: 0};
this.graphic.animate(a);
this.shadowGroup && this.shadowGroup.animate(a)
}, haloPath: function (a) {
var b = this.shapeArgs, c = this.series.chart;
return this.sliced || !this.visible ? [] : this.series.chart.renderer.symbols.arc(c.plotLeft +
b.x, c.plotTop + b.y, b.r + a, b.r + a, {innerR: this.shapeArgs.r, start: b.start, end: b.end})
}
}),
requireSorting: !1,
directTouch: !0,
noSharedTooltip: !0,
trackerGroups: ["group", "dataLabelsGroup"],
axisTypes: [],
pointAttrToOptions: {stroke: "borderColor", "stroke-width": "borderWidth", fill: "color"},
animate: function (a) {
var b = this, c = b.points, d = b.startAngleRad;
a || (t(c, function (a) {
var c = a.graphic, g = a.shapeArgs;
c && (c.attr({r: a.startR || b.center[3] / 2, start: d, end: d}), c.animate({
r: g.r,
start: g.start,
end: g.end
}, b.options.animation))
}), b.animate = null)
},
updateTotals: function () {
var a, b = 0, c = this.points, d = c.length, e, f = this.options.ignoreHiddenPoint;
for (a = 0; a < d; a++) e = c[a], b += f && !e.visible ? 0 : e.y;
this.total = b;
for (a = 0; a < d; a++) e = c[a], e.percentage = 0 < b && (e.visible || !f) ? e.y / b * 100 : 0, e.total = b
},
generatePoints: function () {
Y.prototype.generatePoints.call(this);
this.updateTotals()
},
translate: function (a) {
this.generatePoints();
var b = 0, c = this.options, d = c.slicedOffset, e = d + c.borderWidth, f, g, h, k = c.startAngle || 0,
l = this.startAngleRad = Da / 180 * (k - 90),
k = (this.endAngleRad = Da / 180 * (z(c.endAngle, k + 360) - 90)) - l, m = this.points,
w = c.dataLabels.distance, c = c.ignoreHiddenPoint, y, n = m.length, q;
a || (this.center = a = this.getCenter());
this.getX = function (b, c) {
h = na.asin(U((b - a[1]) / (a[2] / 2 + w), 1));
return a[0] + (c ? -1 : 1) * va(h) * (a[2] / 2 + w)
};
for (y = 0; y < n; y++) {
q = m[y];
f = l + b * k;
if (!c || q.visible) b += q.percentage / 100;
g = l + b * k;
q.shapeType = "arc";
q.shapeArgs = {
x: a[0],
y: a[1],
r: a[2] / 2,
innerR: a[3] / 2,
start: R(1E3 * f) / 1E3,
end: R(1E3 * g) / 1E3
};
h = (g + f) / 2;
h > 1.5 * Da ? h -= 2 * Da : h < -Da / 2 && (h += 2 * Da);
q.slicedTranslation = {translateX: R(va(h) * d), translateY: R(Ca(h) * d)};
f = va(h) * a[2] / 2;
g = Ca(h) * a[2] / 2;
q.tooltipPos = [a[0] + .7 * f, a[1] + .7 * g];
q.half = h < -Da / 2 || h > Da / 2 ? 1 : 0;
q.angle = h;
e = U(e, w / 2);
q.labelPos = [a[0] + f + va(h) * w, a[1] + g + Ca(h) * w, a[0] + f + va(h) * e, a[1] + g + Ca(h) * e, a[0] + f, a[1] + g, 0 > w ? "center" : q.half ? "right" : "left", h]
}
},
drawGraph: null,
drawPoints: function () {
var a = this, b = a.chart.renderer, c, d, e = a.options.shadow, f, g, h, k;
e && !a.shadowGroup && (a.shadowGroup = b.g("shadow").add(a.group));
t(a.points, function (l) {
null !== l.y && (d = l.graphic, h = l.shapeArgs, f = l.shadowGroup, g = l.pointAttr[l.selected ? "select" : ""], g.stroke || (g.stroke = g.fill), e && !f && (f = l.shadowGroup = b.g("shadow").add(a.shadowGroup)), c = l.sliced ? l.slicedTranslation : {
translateX: 0,
translateY: 0
}, f && f.attr(c), d ? d.setRadialReference(a.center).attr(g).animate(O(h, c)) : (k = {"stroke-linejoin": "round"}, l.visible || (k.visibility = "hidden"), l.graphic = d = b[l.shapeType](h).setRadialReference(a.center).attr(g).attr(k).attr(c).add(a.group).shadow(e, f)))
})
},
searchPoint: ka,
sortByAngle: function (a, b) {
a.sort(function (a, d) {
return void 0 !== a.angle && (d.angle - a.angle) * b
})
},
drawLegendSymbol: cb.drawRectangle,
getCenter: Mb.getCenter,
getSymbol: ka
}, Bb = C(Y, Bb);
K.pie = Bb;
Y.prototype.drawDataLabels = function () {
var a = this, b = a.options, c = b.cursor, d = b.dataLabels, e = a.points, f, g, h = a.hasRendered || 0, k, l,
m = a.chart.renderer;
if (d.enabled || a._hasPointLabels) a.dlProcessOptions && a.dlProcessOptions(d), l = a.plotGroup("dataLabelsGroup", "data-labels", d.defer ? "hidden" : "visible", d.zIndex || 6), z(d.defer, !0) && (l.attr({opacity: +h}), h || ga(a, "afterAnimate", function () {
a.visible && l.show();
l[b.animation ? "animate" : "attr"]({opacity: 1}, {duration: 200})
})), g = d, t(e, function (e) {
var h, n = e.dataLabel, q, t, p = e.connector, r = !0, C, H = {};
f = e.dlOptions || e.options && e.options.dataLabels;
h = z(f && f.enabled, g.enabled) && null !== e.y;
if (n && !h) e.dataLabel = n.destroy(); else if (h) {
d = A(g, f);
C = d.style;
h = d.rotation;
q = e.getLabelConfig();
k = d.format ? X(d.format, q) : d.formatter.call(q, d);
C.color = z(d.color, C.color, a.color, "black");
if (n) u(k) ? (n.attr({text: k}), r = !1) : (e.dataLabel = n = n.destroy(), p && (e.connector = p.destroy())); else if (u(k)) {
n = {
fill: d.backgroundColor,
stroke: d.borderColor,
"stroke-width": d.borderWidth,
r: d.borderRadius || 0,
rotation: h,
padding: d.padding,
zIndex: 1
};
"contrast" === C.color && (H.color = d.inside || 0 > d.distance || b.stacking ? m.getContrast(e.color || a.color) : "#000000");
c && (H.cursor = c);
for (t in n) n[t] === J && delete n[t];
n = e.dataLabel = m[h ? "text" : "label"](k, 0, -9999, d.shape, null, null, d.useHTML).attr(n).css(O(C, H)).add(l).shadow(d.shadow)
}
n && a.alignDataLabel(e, n, d, null, r)
}
})
};
Y.prototype.alignDataLabel = function (a, b, c, d, e) {
var f = this.chart, g = f.inverted, h = z(a.plotX, -9999), k = z(a.plotY, -9999), l = b.getBBox(),
m = f.renderer.fontMetrics(c.style.fontSize).b,
w = this.visible && (a.series.forceDL || f.isInsidePlot(h, R(k), g) || d && f.isInsidePlot(h, g ? d.x + 1 : d.y + d.height - 1, g));
w && (d = O({
x: g ? f.plotWidth - k : h,
y: R(g ? f.plotHeight - h : k),
width: 0,
height: 0
}, d), O(c, {
width: l.width,
height: l.height
}), c.rotation ? (a = f.renderer.rotCorr(m, c.rotation), b[e ? "attr" : "animate"]({
x: d.x + c.x + d.width / 2 + a.x,
y: d.y + c.y + d.height / 2
}).attr({align: c.align})) : (b.align(c, null, d), g = b.alignAttr, "justify" === z(c.overflow, "justify") ? this.justifyDataLabel(b, c, g, l, d, e) : z(c.crop, !0) && (w = f.isInsidePlot(g.x, g.y) && f.isInsidePlot(g.x + l.width, g.y + l.height)), c.shape && b.attr({
anchorX: a.plotX,
anchorY: a.plotY
})));
w || (Oa(b), b.attr({y: -9999}), b.placed = !1)
};
Y.prototype.justifyDataLabel = function (a, b, c, d, e, f) {
var g = this.chart, h = b.align, k = b.verticalAlign, l, m, w = a.box ? 0 : a.padding || 0;
l = c.x + w;
0 > l && ("right" === h ? b.align = "left" : b.x = -l, m = !0);
l = c.x + d.width - w;
l > g.plotWidth && ("left" === h ? b.align = "right" : b.x = g.plotWidth - l, m = !0);
l = c.y + w;
0 > l && ("bottom" === k ? b.verticalAlign = "top" : b.y = -l, m = !0);
l = c.y + d.height - w;
l > g.plotHeight && ("top" === k ? b.verticalAlign = "bottom" : b.y = g.plotHeight - l, m = !0);
m && (a.placed = !f, a.align(b, null, e))
};
K.pie && (K.pie.prototype.drawDataLabels = function () {
var a = this, b = a.data, c, d = a.chart, e = a.options.dataLabels, f = z(e.connectorPadding, 10),
g = z(e.connectorWidth, 1), h = d.plotWidth, k = d.plotHeight, l, m, w = z(e.softConnector, !0),
n = e.distance, q = a.center, p = q[2] / 2, r = q[1], u = 0 < n, C, H, v, X = [[], []], B, N, P, M, D,
J = [0, 0, 0, 0], A = function (a, b) {
return b.y - a.y
};
if (a.visible && (e.enabled || a._hasPointLabels)) {
Y.prototype.drawDataLabels.apply(a);
t(b, function (a) {
a.dataLabel && a.visible && X[a.half].push(a)
});
for (M = 2; M--;) {
var E = [], F = [], S = X[M], ta = S.length, K;
if (ta) {
a.sortByAngle(S, M - .5);
for (D = b = 0; !b && S[D];) b = S[D] && S[D].dataLabel && (S[D].dataLabel.getBBox().height || 21), D++;
if (0 < n) {
H = U(r + p + n, d.plotHeight);
for (D = G(0, r - p - n); D <= H; D += b) E.push(D);
H = E.length;
if (ta > H) {
c = [].concat(S);
c.sort(A);
for (D = ta; D--;) c[D].rank = D;
for (D = ta; D--;) S[D].rank >= H && S.splice(D, 1);
ta = S.length
}
for (D = 0; D < ta; D++) {
c = S[D];
v = c.labelPos;
c = 9999;
var O, Q;
for (Q = 0; Q < H; Q++) O = fa(E[Q] - v[1]), O < c && (c = O, K = Q);
if (K < D && null !== E[D]) K = D; else for (H < ta - D + K && null !== E[D] && (K = H - ta + D); null === E[K];) K++;
F.push({c: K, y: E[K]});
E[K] = null
}
F.sort(A)
}
for (D = 0; D < ta; D++) {
c = S[D];
v = c.labelPos;
C = c.dataLabel;
P = !1 === c.visible ? "hidden" : "inherit";
c = v[1];
if (0 < n) {
if (H = F.pop(), K = H.c, N = H.y, c > N && null !== E[K + 1] || c < N && null !== E[K - 1]) N = U(G(0, c), d.plotHeight)
} else N = c;
B = e.justify ? q[0] + (M ? -1 : 1) * (p + n) : a.getX(N === r - p -
n || N === r + p + n ? c : N, M);
C._attr = {visibility: P, align: v[6]};
C._pos = {x: B + e.x + ({left: f, right: -f}[v[6]] || 0), y: N + e.y - 10};
C.connX = B;
C.connY = N;
null === this.options.size && (H = C.width, B - H < f ? J[3] = G(R(H - B + f), J[3]) : B + H > h - f && (J[1] = G(R(B + H - h + f), J[1])), 0 > N - b / 2 ? J[0] = G(R(-N + b / 2), J[0]) : N + b / 2 > k && (J[2] = G(R(N + b / 2 - k), J[2])))
}
}
}
if (0 === Ia(J) || this.verifyDataLabelOverflow(J)) this.placeDataLabels(), u && g && t(this.points, function (b) {
l = b.connector;
v = b.labelPos;
(C = b.dataLabel) && C._pos && b.visible ? (P = C._attr.visibility, B = C.connX, N = C.connY, m = w ? ["M", B + ("left" === v[6] ? 5 : -5), N, "C", B, N, 2 * v[2] - v[4], 2 * v[3] - v[5], v[2], v[3], "L", v[4], v[5]] : ["M", B + ("left" === v[6] ? 5 : -5), N, "L", v[2], v[3], "L", v[4], v[5]], l ? (l.animate({d: m}), l.attr("visibility", P)) : b.connector = l = a.chart.renderer.path(m).attr({
"stroke-width": g,
stroke: e.connectorColor || b.color || "#606060",
visibility: P
}).add(a.dataLabelsGroup)) : l && (b.connector = l.destroy())
})
}
}, K.pie.prototype.placeDataLabels = function () {
t(this.points, function (a) {
var b = a.dataLabel;
b && a.visible && ((a = b._pos) ? (b.attr(b._attr), b[b.moved ? "animate" : "attr"](a), b.moved = !0) : b && b.attr({y: -9999}))
})
}, K.pie.prototype.alignDataLabel = ka, K.pie.prototype.verifyDataLabelOverflow = function (a) {
var b = this.center, c = this.options, d = c.center, e = c.minSize || 80, f = e, g;
null !== d[0] ? f = G(b[2] - G(a[1], a[3]), e) : (f = G(b[2] - a[1] - a[3], e), b[0] += (a[3] - a[1]) / 2);
null !== d[1] ? f = G(U(f, b[2] - G(a[0], a[2])), e) : (f = G(U(f, b[2] - a[0] - a[2]), e), b[1] += (a[0] - a[2]) / 2);
f < b[2] ? (b[2] = f, b[3] = Math.min(q(c.innerSize || 0, f), f), this.translate(b), t(this.points, function (a) {
a.dataLabel && (a.dataLabel._pos = null)
}), this.drawDataLabels && this.drawDataLabels()) : g = !0;
return g
});
K.column && (K.column.prototype.alignDataLabel = function (a, b, c, d, e) {
var f = this.chart.inverted, g = a.series, h = a.dlBox || a.shapeArgs,
k = z(a.below, a.plotY > z(this.translatedThreshold, g.yAxis.len)),
l = z(c.inside, !!this.options.stacking);
h && (d = A(h), 0 > d.y && (d.height += d.y, d.y = 0), h = d.y + d.height - g.yAxis.len, 0 < h && (d.height -= h), f && (d = {
x: g.yAxis.len - d.y - d.height,
y: g.xAxis.len - d.x - d.width,
width: d.height,
height: d.width
}), l || (f ? (d.x += k ? 0 : d.width, d.width = 0) : (d.y += k ? d.height : 0, d.height = 0)));
c.align = z(c.align, !f || l ? "center" : k ? "right" : "left");
c.verticalAlign = z(c.verticalAlign, f || l ? "middle" : k ? "top" : "bottom");
Y.prototype.alignDataLabel.call(this, a, b, c, d, e)
});
var Ta = Q.TrackerMixin = {
drawTrackerPoint: function () {
var a = this, b = a.chart, c = b.pointer, d = a.options.cursor, e = d && {cursor: d}, f = function (a) {
for (var c = a.target, d; c && !d;) d = c.point, c = c.parentNode;
if (d !== J && d !== b.hoverPoint) d.onMouseOver(a)
};
t(a.points, function (a) {
a.graphic && (a.graphic.element.point = a);
a.dataLabel && (a.dataLabel.element.point = a)
});
a._hasTracking || (t(a.trackerGroups, function (b) {
if (a[b] && (a[b].addClass("highcharts-tracker").on("mouseover", f).on("mouseout", function (a) {
c.onTrackerMouseOut(a)
}).css(e), $a)) a[b].on("touchstart", f)
}), a._hasTracking = !0)
}, drawTrackerGraph: function () {
var a = this, b = a.options, c = b.trackByArea, d = [].concat(c ? a.areaPath : a.graphPath), e = d.length,
f = a.chart, g = f.pointer, h = f.renderer, k = f.options.tooltip.snap, l = a.tracker, m = b.cursor,
w = m && {cursor: m}, m = a.singlePoints, n, q = function () {
if (f.hoverSeries !== a) a.onMouseOver()
}, p = "rgba(192,192,192," + (sa ? 1E-4 : .002) + ")";
if (e && !c) for (n = e + 1; n--;) "M" === d[n] && d.splice(n + 1, 0, d[n + 1] - k, d[n + 2], "L"), (n && "M" === d[n] || n === e) && d.splice(n, 0, "L", d[n - 2] + k, d[n - 1]);
for (n = 0; n < m.length; n++) e = m[n], d.push("M", e.plotX - k, e.plotY, "L", e.plotX + k, e.plotY);
l ? l.attr({d: d}) : (a.tracker = h.path(d).attr({
"stroke-linejoin": "round",
visibility: a.visible ? "visible" : "hidden",
stroke: p,
fill: c ? p : "none",
"stroke-width": b.lineWidth + (c ? 0 : 2 * k),
zIndex: 2
}).add(a.group), t([a.tracker, a.markerGroup], function (a) {
a.addClass("highcharts-tracker").on("mouseover", q).on("mouseout", function (a) {
g.onTrackerMouseOut(a)
}).css(w);
if ($a) a.on("touchstart", q)
}))
}
};
K.column && (Ab.prototype.drawTracker = Ta.drawTrackerPoint);
K.pie && (K.pie.prototype.drawTracker = Ta.drawTrackerPoint);
K.scatter && (Pb.prototype.drawTracker = Ta.drawTrackerPoint);
O(nb.prototype, {
setItemEvents: function (a, b, c, d, e) {
var f = this;
(c ? b : a.legendGroup).on("mouseover", function () {
a.setState("hover");
b.css(f.options.itemHoverStyle)
}).on("mouseout", function () {
b.css(a.visible ? d : e);
a.setState()
}).on("click", function (b) {
var c = function () {
a.setVisible && a.setVisible()
};
b = {browserEvent: b};
a.firePointEvent ? a.firePointEvent("legendItemClick", b, c) : da(a, "legendItemClick", b, c)
})
}, createCheckboxForItem: function (a) {
a.checkbox = ca("input", {
type: "checkbox",
checked: a.selected,
defaultChecked: a.selected
}, this.options.itemCheckboxStyle, this.chart.container);
ga(a.checkbox, "click", function (b) {
da(a.series || a, "checkboxClick", {checked: b.target.checked, item: a}, function () {
a.select()
})
})
}
});
la.legend.itemStyle.cursor = "pointer";
O(db.prototype, {
showResetZoom: function () {
var a = this, b = la.lang, c = a.options.chart.resetZoomButton, d = c.theme, e = d.states,
f = "chart" === c.relativeTo ? null : "plotBox";
this.resetZoomButton = a.renderer.button(b.resetZoom, null, null, function () {
a.zoomOut()
}, d, e && e.hover).attr({align: c.position.align, title: b.resetZoomTitle}).add().align(c.position, !1, f)
}, zoomOut: function () {
var a = this;
da(a, "selection", {resetSelection: !0}, function () {
a.zoom()
})
}, zoom: function (a) {
var b, c = this.pointer, d = !1, e;
!a || a.resetSelection ? t(this.axes, function (a) {
b = a.zoom()
}) : t(a.xAxis.concat(a.yAxis), function (a) {
var e = a.axis, h = e.isXAxis;
if (c[h ? "zoomX" : "zoomY"] || c[h ? "pinchX" : "pinchY"]) b = e.zoom(a.min, a.max), e.displayBtn && (d = !0)
});
e = this.resetZoomButton;
d && !e ? this.showResetZoom() : !d && W(e) && (this.resetZoomButton = e.destroy());
b && this.redraw(z(this.options.chart.animation, a && a.animation, 100 > this.pointCount))
}, pan: function (a, b) {
var c = this, d = c.hoverPoints, e;
d && t(d, function (a) {
a.setState()
});
t("xy" === b ? [1, 0] : [1], function (b) {
var d = a[b ? "chartX" : "chartY"], h = c[b ? "xAxis" : "yAxis"][0],
k = c[b ? "mouseDownX" : "mouseDownY"], l = (h.pointRange || 0) / 2, m = h.getExtremes(),
n = h.toValue(k - d, !0) + l, l = h.toValue(k + c[b ? "plotWidth" : "plotHeight"] - d, !0) - l,
k = k > d;
h.series.length && (k || n > U(m.dataMin, m.min)) && (!k || l < G(m.dataMax, m.max)) && (h.setExtremes(n, l, !1, !1, {trigger: "pan"}), e = !0);
c[b ? "mouseDownX" : "mouseDownY"] = d
});
e && c.redraw(!1);
E(c.container, {cursor: "move"})
}
});
O(Ga.prototype, {
select: function (a, b) {
var c = this, d = c.series, e = d.chart;
a = z(a, !c.selected);
c.firePointEvent(a ? "select" : "unselect", {accumulate: b}, function () {
c.selected = c.options.selected = a;
d.options.data[Aa(c, d.data)] = c.options;
c.setState(a && "select");
b || t(e.getSelectedPoints(), function (a) {
a.selected && a !== c && (a.selected = a.options.selected = !1, d.options.data[Aa(a, d.data)] = a.options, a.setState(""), a.firePointEvent("unselect"))
})
})
}, onMouseOver: function (a, b) {
var c = this.series, d = c.chart, e = d.tooltip, f = d.hoverPoint;
if (d.hoverSeries !== c) c.onMouseOver();
if (f && f !== this) f.onMouseOut();
this.series && (this.firePointEvent("mouseOver"), !e || e.shared && !c.noSharedTooltip || e.refresh(this, a), this.setState("hover"), b || (d.hoverPoint = this))
}, onMouseOut: function () {
var a = this.series.chart, b = a.hoverPoints;
this.firePointEvent("mouseOut");
b && -1 !== Aa(this, b) || (this.setState(), a.hoverPoint = null)
}, importEvents: function () {
if (!this.hasImportedEvents) {
var a = A(this.series.options.point, this.options).events, b;
this.events = a;
for (b in a) ga(this, b, a[b]);
this.hasImportedEvents = !0
}
}, setState: function (a, b) {
var c = ea(this.plotX), d = this.plotY, e = this.series, f = e.options.states,
g = aa[e.type].marker && e.options.marker, h = g && !g.enabled, k = g && g.states[a],
l = k && !1 === k.enabled, m = e.stateMarkerGraphic, n = this.marker || {}, q = e.chart, x = e.halo, t;
a = a || "";
t = this.pointAttr[a] || e.pointAttr[a];
if (!(a === this.state && !b || this.selected && "select" !== a || f[a] && !1 === f[a].enabled || a && (l || h && !1 === k.enabled) || a && n.states && n.states[a] && !1 === n.states[a].enabled)) {
if (this.graphic) g = g && this.graphic.symbolName && t.r, this.graphic.attr(A(t, g ? {
x: c - g,
y: d - g,
width: 2 * g,
height: 2 * g
} : {})), m && m.hide(); else {
if (a && k) if (g = k.radius, n = n.symbol || e.symbol, m && m.currentSymbol !== n && (m = m.destroy()), m) m[b ? "animate" : "attr"]({
x: c - g,
y: d - g
}); else n && (e.stateMarkerGraphic = m = q.renderer.symbol(n, c - g, d - g, 2 * g, 2 * g).attr(t).add(e.markerGroup), m.currentSymbol = n);
m && (m[a && q.isInsidePlot(c, d, q.inverted) ? "show" : "hide"](), m.element.point = this)
}
(c = f[a] && f[a].halo) && c.size ? (x || (e.halo = x = q.renderer.path().add(q.seriesGroup)), x.attr(O({
fill: this.color || e.color,
"fill-opacity": c.opacity
}, c.attributes))[b ? "animate" : "attr"]({d: this.haloPath(c.size)})) : x && x.attr({d: []});
this.state = a
}
}, haloPath: function (a) {
var b = this.series, c = b.chart, d = b.getPlotBox(), e = c.inverted, f = Math.floor(this.plotX);
return c.renderer.symbols.circle(d.translateX + (e ? b.yAxis.len - this.plotY : f) - a, d.translateY + (e ? b.xAxis.len - f : this.plotY) - a, 2 * a, 2 * a)
}
});
O(Y.prototype, {
onMouseOver: function () {
var a = this.chart, b = a.hoverSeries;
if (b && b !== this) b.onMouseOut();
this.options.events.mouseOver && da(this, "mouseOver");
this.setState("hover");
a.hoverSeries = this
}, onMouseOut: function () {
var a = this.options, b = this.chart, c = b.tooltip, d = b.hoverPoint;
b.hoverSeries = null;
if (d) d.onMouseOut();
this && a.events.mouseOut && da(this, "mouseOut");
!c || a.stickyTracking || c.shared && !this.noSharedTooltip || c.hide();
this.setState()
}, setState: function (a) {
var b = this.options, c = this.graph, d = b.states, e = b.lineWidth, b = 0;
a = a || "";
if (this.state !== a && (this.state = a, !d[a] || !1 !== d[a].enabled) && (a && (e = d[a].lineWidth || e + (d[a].lineWidthPlus || 0)), c && !c.dashstyle)) for (a = {"stroke-width": e}, c.attr(a); this["zoneGraph" +
b];) this["zoneGraph" + b].attr(a), b += 1
}, setVisible: function (a, b) {
var c = this, d = c.chart, e = c.legendItem, f, g = d.options.chart.ignoreHiddenSeries, h = c.visible;
f = (c.visible = a = c.userOptions.visible = a === J ? !h : a) ? "show" : "hide";
t(["group", "dataLabelsGroup", "markerGroup", "tracker"], function (a) {
if (c[a]) c[a][f]()
});
if (d.hoverSeries === c || (d.hoverPoint && d.hoverPoint.series) === c) c.onMouseOut();
e && d.legend.colorizeItem(c, a);
c.isDirty = !0;
c.options.stacking && t(d.series, function (a) {
a.options.stacking && a.visible && (a.isDirty = !0)
});
t(c.linkedSeries, function (b) {
b.setVisible(a, !1)
});
g && (d.isDirtyBox = !0);
!1 !== b && d.redraw();
da(c, f)
}, show: function () {
this.setVisible(!0)
}, hide: function () {
this.setVisible(!1)
}, select: function (a) {
this.selected = a = a === J ? !this.selected : a;
this.checkbox && (this.checkbox.checked = a);
da(this, a ? "select" : "unselect")
}, drawTracker: Ta.drawTrackerGraph
});
O(Ya.prototype, {
init: function (a, b, c) {
var d = this, e = d.defaultOptions;
d.chart = b;
d.options = a = A(e, b.angular ? {background: {}} : void 0, a);
(a = a.background) && t([].concat(S(a)).reverse(), function (a) {
var b = a.backgroundColor, e = c.userOptions;
a = A(d.defaultBackgroundOptions, a);
b && (a.backgroundColor = b);
a.color = a.backgroundColor;
c.options.plotBands.unshift(a);
e.plotBands = e.plotBands || [];
e.plotBands !== c.options.plotBands && e.plotBands.unshift(a)
})
},
defaultOptions: {center: ["50%", "50%"], size: "85%", startAngle: 0},
defaultBackgroundOptions: {
shape: "circle",
borderWidth: 1,
borderColor: "silver",
backgroundColor: {linearGradient: {x1: 0, y1: 0, x2: 0, y2: 1}, stops: [[0, "#FFF"], [1, "#DDD"]]},
from: -Number.MAX_VALUE,
innerRadius: 0,
to: Number.MAX_VALUE,
outerRadius: "105%"
}
});
var ob = wa.prototype, Cb = xa.prototype, Xb = {
getOffset: ka, redraw: function () {
this.isDirty = !1
}, render: function () {
this.isDirty = !1
}, setScale: ka, setCategories: ka, setTitle: ka
}, Qb = {
isRadial: !0,
defaultRadialGaugeOptions: {
labels: {align: "center", x: 0, y: null},
minorGridLineWidth: 0,
minorTickInterval: "auto",
minorTickLength: 10,
minorTickPosition: "inside",
minorTickWidth: 1,
tickLength: 10,
tickPosition: "inside",
tickWidth: 2,
title: {rotation: 0},
zIndex: 2
},
defaultRadialXOptions: {
gridLineWidth: 1,
labels: {align: null, distance: 15, x: 0, y: null},
maxPadding: 0,
minPadding: 0,
showLastLabel: !1,
tickLength: 0
},
defaultRadialYOptions: {
gridLineInterpolation: "circle",
labels: {align: "right", x: -3, y: -2},
showLastLabel: !1,
title: {x: 4, text: null, rotation: 90}
},
setOptions: function (a) {
a = this.options = A(this.defaultOptions, this.defaultRadialOptions, a);
a.plotBands || (a.plotBands = [])
},
getOffset: function () {
ob.getOffset.call(this);
this.chart.axisOffset[this.side] = 0;
this.center = this.pane.center = Mb.getCenter.call(this.pane)
},
getLinePath: function (a, b) {
var c = this.center;
b = z(b, c[2] / 2 - this.offset);
return this.chart.renderer.symbols.arc(this.left + c[0], this.top + c[1], b, b, {
start: this.startAngleRad,
end: this.endAngleRad,
open: !0,
innerR: 0
})
},
setAxisTranslation: function () {
ob.setAxisTranslation.call(this);
this.center && (this.transA = this.isCircular ? (this.endAngleRad - this.startAngleRad) / (this.max - this.min || 1) : this.center[2] / 2 / (this.max - this.min || 1), this.minPixelPadding = this.isXAxis ? this.transA * this.minPointOffset : 0)
},
beforeSetTickPositions: function () {
this.autoConnect && (this.max += this.categories && 1 || this.pointRange || this.closestPointRange || 0)
},
setAxisSize: function () {
ob.setAxisSize.call(this);
this.isRadial && (this.center = this.pane.center = Q.CenteredSeriesMixin.getCenter.call(this.pane), this.isCircular && (this.sector = this.endAngleRad - this.startAngleRad), this.len = this.width = this.height = this.center[2] * z(this.sector, 1) / 2)
},
getPosition: function (a, b) {
return this.postTranslate(this.isCircular ? this.translate(a) : 0, z(this.isCircular ? b : this.translate(a), this.center[2] / 2) - this.offset)
},
postTranslate: function (a, b) {
var c = this.chart, d = this.center;
a = this.startAngleRad + a;
return {x: c.plotLeft + d[0] + Math.cos(a) * b, y: c.plotTop + d[1] + Math.sin(a) * b}
},
getPlotBandPath: function (a, b, c) {
var d = this.center, e = this.startAngleRad, f = d[2] / 2,
g = [z(c.outerRadius, "100%"), c.innerRadius, z(c.thickness, 10)], h = /%$/, k, l = this.isCircular;
"polygon" === this.options.gridLineInterpolation ? d = this.getPlotLinePath(a).concat(this.getPlotLinePath(b, !0)) : (a = Math.max(a, this.min), b = Math.min(b, this.max), l || (g[0] = this.translate(a), g[1] = this.translate(b)), g = Ea(g, function (a) {
h.test(a) && (a = F(a, 10) * f / 100);
return a
}), "circle" !== c.shape && l ? (a = e + this.translate(a), b = e + this.translate(b)) : (a = -Math.PI / 2, b = 1.5 * Math.PI, k = !0), d = this.chart.renderer.symbols.arc(this.left + d[0], this.top + d[1], g[0], g[0], {
start: Math.min(a, b),
end: Math.max(a, b),
innerR: z(g[1], g[0] - g[2]),
open: k
}));
return d
},
getPlotLinePath: function (a, b) {
var c = this, d = c.center, e = c.chart, f = c.getPosition(a), g, h, k;
c.isCircular ? k = ["M", d[0] + e.plotLeft, d[1] + e.plotTop, "L", f.x, f.y] : "circle" === c.options.gridLineInterpolation ? (a = c.translate(a)) && (k = c.getLinePath(0, a)) : (t(e.xAxis, function (a) {
a.pane === c.pane && (g = a)
}), k = [], a = c.translate(a), d = g.tickPositions, g.autoConnect && (d = d.concat([d[0]])), b && (d = [].concat(d).reverse()), t(d, function (b, c) {
h = g.getPosition(b, a);
k.push(c ? "L" : "M", h.x, h.y)
}));
return k
},
getTitlePosition: function () {
var a = this.center, b = this.chart, c = this.options.title;
return {
x: b.plotLeft + a[0] + (c.x || 0),
y: b.plotTop + a[1] - {high: .5, middle: .25, low: 0}[c.align] * a[2] + (c.y || 0)
}
}
};
qa(ob, "init", function (a, b, c) {
var d = b.angular, e = b.polar, f = c.isX, g = d && f, h, k;
k = b.options;
var l = c.pane || 0;
if (d) {
if (O(this, g ? Xb : Qb), h = !f) this.defaultRadialOptions = this.defaultRadialGaugeOptions
} else e && (O(this, Qb), this.defaultRadialOptions = (h = f) ? this.defaultRadialXOptions : A(this.defaultYAxisOptions, this.defaultRadialYOptions));
a.call(this, b, c);
g || !d && !e || (a = this.options, b.panes || (b.panes = []), this.pane = l = b.panes[l] = b.panes[l] || new Ya(S(k.pane)[l], b, this), l = l.options, b.inverted = !1, k.chart.zoomType = null, this.startAngleRad = b = (l.startAngle - 90) * Math.PI / 180, this.endAngleRad = k = (z(l.endAngle, l.startAngle + 360) - 90) * Math.PI / 180, this.offset = a.offset || 0, (this.isCircular = h) && c.max === J && k - b === 2 * Math.PI && (this.autoConnect = !0))
});
qa(Cb, "getPosition", function (a, b, c, d, e) {
var f = this.axis;
return f.getPosition ? f.getPosition(c) : a.call(this, b, c, d, e)
});
qa(Cb, "getLabelPosition", function (a, b, c, d, e, f, g, h, k) {
var l = this.axis, m = f.y, n = 20, q = f.align,
t = (l.translate(this.pos) + l.startAngleRad + Math.PI / 2) / Math.PI * 180 % 360;
l.isRadial ? (a = l.getPosition(this.pos, l.center[2] / 2 + z(f.distance, -25)), "auto" === f.rotation ? d.attr({rotation: t}) : null === m && (m = l.chart.renderer.fontMetrics(d.styles.fontSize).b - d.getBBox().height / 2), null === q && (l.isCircular ? (this.label.getBBox().width > l.len * l.tickInterval / (l.max - l.min) && (n = 0), q = t > n && t < 180 - n ? "left" : t > 180 + n && t < 360 - n ? "right" : "center") : q = "center", d.attr({align: q})), a.x += f.x, a.y += m) : a = a.call(this, b, c, d, e, f, g, h, k);
return a
});
qa(Cb, "getMarkPath", function (a, b, c, d, e, f, g) {
var h = this.axis;
h.isRadial ? (a = h.getPosition(this.pos, h.center[2] / 2 + d), b = ["M", b, c, "L", a.x, a.y]) : b = a.call(this, b, c, d, e, f, g);
return b
});
aa.arearange = A(aa.area, {
lineWidth: 1,
marker: null,
threshold: null,
tooltip: {pointFormat: '\u25cf {series.name}: {point.low} - {point.high} '},
trackByArea: !0,
dataLabels: {align: null, verticalAlign: null, xLow: 0, xHigh: 0, yLow: 0, yHigh: 0},
states: {hover: {halo: !1}}
});
K.arearange = C(K.area, {
type: "arearange",
pointArrayMap: ["low", "high"],
dataLabelCollections: ["dataLabel", "dataLabelUpper"],
toYData: function (a) {
return [a.low, a.high]
},
pointValKey: "low",
deferTranslatePolar: !0,
highToXY: function (a) {
var b = this.chart, c = this.xAxis.postTranslate(a.rectPlotX, this.yAxis.len - a.plotHigh);
a.plotHighX = c.x - b.plotLeft;
a.plotHigh = c.y - b.plotTop
},
getSegments: function () {
var a = this;
t(a.points, function (b) {
a.options.connectNulls || null !== b.low && null !== b.high ? null === b.low && null !== b.high && (b.y = b.high) : b.y = null
});
Y.prototype.getSegments.call(this)
},
translate: function () {
var a = this, b = a.yAxis;
K.area.prototype.translate.apply(a);
t(a.points, function (a) {
var d = a.low, e = a.high, f = a.plotY;
null === e && null === d ? a.y = null : null === d ? (a.plotLow = a.plotY = null, a.plotHigh = b.translate(e, 0, 1, 0, 1)) : null === e ? (a.plotLow = f, a.plotHigh = null) : (a.plotLow = f, a.plotHigh = b.translate(e, 0, 1, 0, 1))
});
this.chart.polar && t(this.points, function (b) {
a.highToXY(b)
})
},
getSegmentPath: function (a) {
var b, c = [], d = a.length, e = Y.prototype.getSegmentPath, f, g;
g = this.options;
var h = g.step;
for (b = Q.grep(a, function (a) {
return null !== a.plotLow
}); d--;) f = a[d], null !== f.plotHigh && c.push({plotX: f.plotHighX || f.plotX, plotY: f.plotHigh});
a = e.call(this, b);
h && (!0 === h && (h = "left"), g.step = {left: "right", center: "center", right: "left"}[h]);
c = e.call(this, c);
g.step = h;
g = [].concat(a, c);
this.chart.polar || (c[0] = "L");
this.areaPath = this.areaPath.concat(a, c);
return g
},
drawDataLabels: function () {
var a = this.data, b = a.length, c, d = [], e = Y.prototype, f = this.options.dataLabels, g = f.align,
h = f.verticalAlign, k = f.inside, l, m, n = this.chart.inverted;
if (f.enabled || this._hasPointLabels) {
for (c = b; c--;) if (l = a[c]) m = k ? l.plotHigh < l.plotLow : l.plotHigh > l.plotLow, l.y = l.high, l._plotY = l.plotY, l.plotY = l.plotHigh, d[c] = l.dataLabel, l.dataLabel = l.dataLabelUpper, l.below = m, n ? g || (f.align = m ? "right" : "left") : h || (f.verticalAlign = m ? "top" : "bottom"), f.x = f.xHigh, f.y = f.yHigh;
e.drawDataLabels && e.drawDataLabels.apply(this, arguments);
for (c = b; c--;) if (l = a[c]) m = k ? l.plotHigh < l.plotLow : l.plotHigh > l.plotLow, l.dataLabelUpper = l.dataLabel, l.dataLabel = d[c], l.y = l.low, l.plotY = l._plotY, l.below = !m, n ? g || (f.align = m ? "left" : "right") : h || (f.verticalAlign = m ? "bottom" : "top"), f.x = f.xLow, f.y = f.yLow;
e.drawDataLabels && e.drawDataLabels.apply(this, arguments)
}
f.align = g;
f.verticalAlign = h
},
alignDataLabel: function () {
K.column.prototype.alignDataLabel.apply(this, arguments)
},
setStackedPoints: ka,
getSymbol: ka,
drawPoints: ka
});
aa.areasplinerange = A(aa.arearange);
K.areasplinerange = C(K.arearange, {type: "areasplinerange", getPointSpline: K.spline.prototype.getPointSpline});
(function () {
var a = K.column.prototype;
aa.columnrange = A(aa.column, aa.arearange, {lineWidth: 1, pointRange: null});
K.columnrange = C(K.arearange, {
type: "columnrange",
translate: function () {
var b = this, c = b.yAxis, d = b.xAxis, e = b.chart, f;
a.translate.apply(b);
t(b.points, function (a) {
var h = a.shapeArgs, k = b.options.minPointLength, l, m;
a.plotHigh = f = c.translate(a.high, 0, 1, 0, 1);
a.plotLow = a.plotY;
m = f;
l = a.plotY - f;
Math.abs(l) < k ? (k -= l, l += k, m -= k / 2) : 0 > l && (l *= -1, m -= l);
h.height = l;
h.y = m;
a.tooltipPos = e.inverted ? [c.len + c.pos - e.plotLeft - m - l / 2, d.len + d.pos - e.plotTop - h.x - h.width / 2, l] : [d.left - e.plotLeft + h.x + h.width / 2, c.pos - e.plotTop + m + l / 2, l]
})
},
directTouch: !0,
trackerGroups: ["group", "dataLabelsGroup"],
drawGraph: ka,
crispCol: a.crispCol,
pointAttrToOptions: a.pointAttrToOptions,
drawPoints: a.drawPoints,
drawTracker: a.drawTracker,
animate: a.animate,
getColumnMetrics: a.getColumnMetrics
})
})();
aa.gauge = A(aa.line, {
dataLabels: {
enabled: !0,
defer: !1,
y: 15,
borderWidth: 1,
borderColor: "silver",
borderRadius: 3,
crop: !1,
verticalAlign: "top",
zIndex: 2
}, dial: {}, pivot: {}, tooltip: {headerFormat: ""}, showInLegend: !1
});
var Yb = {
type: "gauge",
pointClass: C(Ga, {
setState: function (a) {
this.state = a
}
}),
angular: !0,
drawGraph: ka,
fixedBox: !0,
forceDL: !0,
trackerGroups: ["group", "dataLabelsGroup"],
translate: function () {
var a = this.yAxis, b = this.options, c = a.center;
this.generatePoints();
t(this.points, function (d) {
var e = A(b.dial, d.dial), f = F(z(e.radius, 80)) * c[2] / 200, g = F(z(e.baseLength, 70)) * f / 100,
h = F(z(e.rearLength, 10)) * f / 100, k = e.baseWidth || 3, l = e.topWidth || 1, m = b.overshoot,
n = a.startAngleRad + a.translate(d.y, null, null, null, !0);
m && "number" === typeof m ? (m = m / 180 * Math.PI, n = Math.max(a.startAngleRad - m, Math.min(a.endAngleRad + m, n))) : !1 === b.wrap && (n = Math.max(a.startAngleRad, Math.min(a.endAngleRad, n)));
n = 180 * n / Math.PI;
d.shapeType = "path";
d.shapeArgs = {
d: e.path || ["M", -h, -k / 2, "L", g, -k / 2, f, -l / 2, f, l / 2, g, k / 2, -h, k / 2, "z"],
translateX: c[0],
translateY: c[1],
rotation: n
};
d.plotX = c[0];
d.plotY = c[1]
})
},
drawPoints: function () {
var a = this, b = a.yAxis.center, c = a.pivot, d = a.options, e = d.pivot, f = a.chart.renderer;
t(a.points, function (b) {
var c = b.graphic, e = b.shapeArgs, l = e.d, m = A(d.dial, b.dial);
c ? (c.animate(e), e.d = l) : b.graphic = f[b.shapeType](e).attr({
stroke: m.borderColor || "none",
"stroke-width": m.borderWidth || 0,
fill: m.backgroundColor || "black",
rotation: e.rotation,
zIndex: 1
}).add(a.group)
});
c ? c.animate({
translateX: b[0],
translateY: b[1]
}) : a.pivot = f.circle(0, 0, z(e.radius, 5)).attr({
"stroke-width": e.borderWidth || 0,
stroke: e.borderColor || "silver",
fill: e.backgroundColor || "black",
zIndex: 2
}).translate(b[0], b[1]).add(a.group)
},
animate: function (a) {
var b = this;
a || (t(b.points, function (a) {
var d = a.graphic;
d && (d.attr({rotation: 180 * b.yAxis.startAngleRad / Math.PI}), d.animate({rotation: a.shapeArgs.rotation}, b.options.animation))
}), b.animate = null)
},
render: function () {
this.group = this.plotGroup("group", "series", this.visible ? "visible" : "hidden", this.options.zIndex, this.chart.seriesGroup);
Y.prototype.render.call(this);
this.group.clip(this.chart.clipRect)
},
setData: function (a, b) {
Y.prototype.setData.call(this, a, !1);
this.processData();
this.generatePoints();
z(b, !0) && this.chart.redraw()
},
drawTracker: Ta && Ta.drawTrackerPoint
};
K.gauge = C(K.line, Yb);
aa.boxplot = A(aa.column, {
fillColor: "#FFFFFF",
lineWidth: 1,
medianWidth: 2,
states: {hover: {brightness: -.3}},
threshold: null,
tooltip: {pointFormat: '\u25cf {series.name} Maximum: {point.high} Upper quartile: {point.q3} Median: {point.median} Lower quartile: {point.q1} Minimum: {point.low} '},
whiskerLength: "50%",
whiskerWidth: 2
});
K.boxplot = C(K.column, {
type: "boxplot",
pointArrayMap: ["low", "q1", "median", "q3", "high"],
toYData: function (a) {
return [a.low, a.q1, a.median, a.q3, a.high]
},
pointValKey: "high",
pointAttrToOptions: {fill: "fillColor", stroke: "color", "stroke-width": "lineWidth"},
drawDataLabels: ka,
translate: function () {
var a = this.yAxis, b = this.pointArrayMap;
K.column.prototype.translate.apply(this);
t(this.points, function (c) {
t(b, function (b) {
null !== c[b] && (c[b + "Plot"] = a.translate(c[b], 0, 1, 0, 1))
})
})
},
drawPoints: function () {
var a = this, b = a.options, c = a.chart.renderer, d, e, f, g, h, k, l, m, n, q, x, p, r, C, u, H, v, B, X,
N, D, P, M = !1 !== a.doQuartiles, E, G = a.options.whiskerLength;
t(a.points, function (t) {
n = t.graphic;
D = t.shapeArgs;
x = {};
C = {};
H = {};
P = t.color || a.color;
t.plotY !== J && (d = t.pointAttr[t.selected ? "selected" : ""], v = D.width, B = ea(D.x), X = B + v, N = R(v / 2), e = ea(M ? t.q1Plot : t.lowPlot), f = ea(M ? t.q3Plot : t.lowPlot), g = ea(t.highPlot), h = ea(t.lowPlot), x.stroke = t.stemColor || b.stemColor || P, x["stroke-width"] = z(t.stemWidth, b.stemWidth, b.lineWidth), x.dashstyle = t.stemDashStyle || b.stemDashStyle, C.stroke = t.whiskerColor || b.whiskerColor || P, C["stroke-width"] = z(t.whiskerWidth, b.whiskerWidth, b.lineWidth), H.stroke = t.medianColor || b.medianColor || P, H["stroke-width"] = z(t.medianWidth, b.medianWidth, b.lineWidth), l = x["stroke-width"] % 2 / 2, m = B + N + l, q = ["M", m, f, "L", m, g, "M", m, e, "L", m, h], M && (l = d["stroke-width"] % 2 / 2, m = ea(m) + l, e = ea(e) + l, f = ea(f) + l, B += l, X += l, p = ["M", B, f, "L", B, e, "L", X, e, "L", X, f, "L", B, f, "z"]), G && (l = C["stroke-width"] % 2 / 2, g += l, h += l, E = /%$/.test(G) ? N * parseFloat(G) / 100 : G / 2, r = ["M", m - E, g, "L", m + E, g, "M", m - E, h, "L", m + E, h]), l = H["stroke-width"] % 2 / 2, k = R(t.medianPlot) + l, u = ["M", B, k, "L", X, k], n ? (t.stem.animate({d: q}), G && t.whiskers.animate({d: r}), M && t.box.animate({d: p}), t.medianShape.animate({d: u})) : (t.graphic = n = c.g().add(a.group), t.stem = c.path(q).attr(x).add(n), G && (t.whiskers = c.path(r).attr(C).add(n)), M && (t.box = c.path(p).attr(d).add(n)), t.medianShape = c.path(u).attr(H).add(n)))
})
},
setStackedPoints: ka
});
aa.errorbar = A(aa.boxplot, {
color: "#000000",
grouping: !1,
linkedTo: ":previous",
tooltip: {pointFormat: '\u25cf {series.name}: {point.low} - {point.high} '},
whiskerWidth: null
});
K.errorbar = C(K.boxplot, {
type: "errorbar",
pointArrayMap: ["low", "high"],
toYData: function (a) {
return [a.low, a.high]
},
pointValKey: "high",
doQuartiles: !1,
drawDataLabels: K.arearange ? K.arearange.prototype.drawDataLabels : ka,
getColumnMetrics: function () {
return this.linkedParent && this.linkedParent.columnMetrics || K.column.prototype.getColumnMetrics.call(this)
}
});
aa.waterfall = A(aa.column, {
lineWidth: 1,
lineColor: "#333",
dashStyle: "dot",
borderColor: "#333",
dataLabels: {inside: !0},
states: {hover: {lineWidthPlus: 0}}
});
K.waterfall = C(K.column, {
type: "waterfall", upColorProp: "fill", pointValKey: "y", translate: function () {
var a = this.options, b = this.yAxis, c, d, e, f, g, h, k, l, m, n = z(a.minPointLength, 5),
q = a.threshold, t = a.stacking;
K.column.prototype.translate.apply(this);
this.minPointLengthOffset = 0;
k = l = q;
d = this.points;
c = 0;
for (a = d.length; c < a; c++) e = d[c], h = this.processedYData[c], f = e.shapeArgs, m = (g = t && b.stacks[(this.negStacks && h < q ? "-" : "") + this.stackKey]) ? g[e.x].points[this.index + "," + c] : [0, h], e.isSum ? e.y = h : e.isIntermediateSum && (e.y = h -
l), g = G(k, k + e.y) + m[0], f.y = b.translate(g, 0, 1), e.isSum ? (f.y = b.translate(m[1], 0, 1), f.height = Math.min(b.translate(m[0], 0, 1), b.len) - f.y + this.minPointLengthOffset) : e.isIntermediateSum ? (f.y = b.translate(m[1], 0, 1), f.height = Math.min(b.translate(l, 0, 1), b.len) - f.y + this.minPointLengthOffset, l = m[1]) : (0 !== k && (f.height = 0 < h ? b.translate(k, 0, 1) - f.y : b.translate(k, 0, 1) - b.translate(k - h, 0, 1)), k += h), 0 > f.height && (f.y += f.height, f.height *= -1), e.plotY = f.y = R(f.y) - this.borderWidth % 2 / 2, f.height = G(R(f.height), .001), e.yBottom = f.y +
f.height, f.height <= n && (f.height = n, this.minPointLengthOffset += n), f.y -= this.minPointLengthOffset, f = e.plotY + (e.negative ? f.height : 0) - this.minPointLengthOffset, this.chart.inverted ? e.tooltipPos[0] = b.len - f : e.tooltipPos[1] = f
}, processData: function (a) {
var b = this.yData, c = this.options.data, d, e = b.length, f, g, h, k, l, m;
g = f = h = k = this.options.threshold || 0;
for (m = 0; m < e; m++) l = b[m], d = c && c[m] ? c[m] : {}, "sum" === l || d.isSum ? b[m] = g : "intermediateSum" === l || d.isIntermediateSum ? b[m] = f : (g += l, f += l), h = Math.min(g, h), k = Math.max(g, k);
Y.prototype.processData.call(this, a);
this.dataMin = h;
this.dataMax = k
}, toYData: function (a) {
return a.isSum ? 0 === a.x ? null : "sum" : a.isIntermediateSum ? 0 === a.x ? null : "intermediateSum" : a.y
}, getAttribs: function () {
K.column.prototype.getAttribs.apply(this, arguments);
var a = this, b = a.options, c = b.states, d = b.upColor || a.color, b = Q.Color(d).brighten(.1).get(),
e = A(a.pointAttr), f = a.upColorProp;
e[""][f] = d;
e.hover[f] = c.hover.upColor || b;
e.select[f] = c.select.upColor || d;
t(a.points, function (b) {
b.options.color || (0 < b.y ? (b.pointAttr = e, b.color = d) : b.pointAttr = a.pointAttr)
})
}, getGraphPath: function () {
var a = this.data, b = a.length, c = R(this.options.lineWidth + this.borderWidth) % 2 / 2, d = [], e, f, g;
for (g = 1; g < b; g++) f = a[g].shapeArgs, e = a[g - 1].shapeArgs, f = ["M", e.x + e.width, e.y + c, "L", f.x, e.y + c], 0 > a[g - 1].y && (f[2] += e.height, f[5] += e.height), d = d.concat(f);
return d
}, getExtremes: ka, drawGraph: Y.prototype.drawGraph
});
(function () {
function a(a, b, c) {
a.call(this, b, c);
this.chart.polar && (this.closeSegment = function (a) {
var b = this.xAxis.center;
a.push("L", b[0], b[1])
}, this.closedStacks = !0)
}
function b(a, b) {
var c = this.chart, d = this.options.animation, e = this.group, m = this.markerGroup, n = this.xAxis.center,
q = c.plotLeft, t = c.plotTop;
c.polar ? c.renderer.isSVG && (!0 === d && (d = {}), b ? (c = {
translateX: n[0] + q,
translateY: n[1] + t,
scaleX: .001,
scaleY: .001
}, e.attr(c), m && m.attr(c)) : (c = {
translateX: q,
translateY: t,
scaleX: 1,
scaleY: 1
}, e.animate(c, d), m && m.animate(c, d), this.animate = null)) : a.call(this, b)
}
var c = Y.prototype, d = yb.prototype, e;
c.searchPointByAngle = function (a) {
var b = this.chart, c = this.xAxis.pane.center;
return this.searchKDTree({
clientX: 180 +
-180 / Math.PI * Math.atan2(a.chartX - c[0] - b.plotLeft, a.chartY - c[1] - b.plotTop)
})
};
qa(c, "buildKDTree", function (a) {
this.chart.polar && (this.kdByAngle ? this.searchPoint = this.searchPointByAngle : this.kdDimensions = 2);
a.apply(this)
});
c.toXY = function (a) {
var b, c = this.chart, d = a.plotX;
b = a.plotY;
a.rectPlotX = d;
a.rectPlotY = b;
b = this.xAxis.postTranslate(a.plotX, this.yAxis.len - b);
a.plotX = a.polarPlotX = b.x - c.plotLeft;
a.plotY = a.polarPlotY = b.y - c.plotTop;
this.kdByAngle ? (c = (d / Math.PI * 180 + this.xAxis.pane.options.startAngle) % 360, 0 > c && (c += 360), a.clientX = c) : a.clientX = a.plotX
};
K.area && qa(K.area.prototype, "init", a);
K.areaspline && qa(K.areaspline.prototype, "init", a);
K.spline && qa(K.spline.prototype, "getPointSpline", function (a, b, c, d) {
var e, m, n, q, t, p, r;
this.chart.polar ? (e = c.plotX, m = c.plotY, a = b[d - 1], n = b[d + 1], this.connectEnds && (a || (a = b[b.length - 2]), n || (n = b[1])), a && n && (q = a.plotX, t = a.plotY, b = n.plotX, p = n.plotY, q = (1.5 * e + q) / 2.5, t = (1.5 * m + t) / 2.5, n = (1.5 * e + b) / 2.5, r = (1.5 * m + p) / 2.5, b = Math.sqrt(Math.pow(q - e, 2) + Math.pow(t - m, 2)), p = Math.sqrt(Math.pow(n -
e, 2) + Math.pow(r - m, 2)), q = Math.atan2(t - m, q - e), t = Math.atan2(r - m, n - e), r = Math.PI / 2 + (q + t) / 2, Math.abs(q - r) > Math.PI / 2 && (r -= Math.PI), q = e + Math.cos(r) * b, t = m + Math.sin(r) * b, n = e + Math.cos(Math.PI + r) * p, r = m + Math.sin(Math.PI + r) * p, c.rightContX = n, c.rightContY = r), d ? (c = ["C", a.rightContX || a.plotX, a.rightContY || a.plotY, q || e, t || m, e, m], a.rightContX = a.rightContY = null) : c = ["M", e, m]) : c = a.call(this, b, c, d);
return c
});
qa(c, "translate", function (a) {
var b = this.chart;
a.call(this);
if (b.polar && (this.kdByAngle = b.tooltip && b.tooltip.shared, !this.preventPostTranslate)) for (a = this.points, b = a.length; b--;) this.toXY(a[b])
});
qa(c, "getSegmentPath", function (a, b) {
var c = this.points;
this.chart.polar && !1 !== this.options.connectEnds && b[b.length - 1] === c[c.length - 1] && null !== c[0].y && (this.connectEnds = !0, b = [].concat(b, [c[0]]));
return a.call(this, b)
});
qa(c, "animate", b);
K.column && (e = K.column.prototype, qa(e, "animate", b), qa(e, "translate", function (a) {
var b = this.xAxis, c = this.yAxis.len, d = b.center, e = b.startAngleRad, m = this.chart.renderer, n, q;
this.preventPostTranslate = !0;
a.call(this);
if (b.isRadial) for (b = this.points, q = b.length; q--;) n = b[q], a = n.barX + e, n.shapeType = "path", n.shapeArgs = {
d: m.symbols.arc(d[0], d[1], c - n.plotY, null, {
start: a,
end: a + n.pointWidth,
innerR: c - z(n.yBottom, c)
})
}, this.toXY(n), n.tooltipPos = [n.plotX, n.plotY], n.ttBelow = n.plotY > d[1]
}), qa(e, "alignDataLabel", function (a, b, d, e, l, m) {
this.chart.polar ? (a = b.rectPlotX / Math.PI * 180, null === e.align && (e.align = 20 < a && 160 > a ? "left" : 200 < a && 340 > a ? "right" : "center"), null === e.verticalAlign && (e.verticalAlign = 45 > a || 315 < a ? "bottom" : 135 < a && 225 > a ? "top" : "middle"), c.alignDataLabel.call(this, b, d, e, l, m)) : a.call(this, b, d, e, l, m)
}));
qa(d, "getCoordinates", function (a, b) {
var c = this.chart, d = {xAxis: [], yAxis: []};
c.polar ? t(c.axes, function (a) {
var e = a.isXAxis, f = a.center, n = b.chartX - f[0] - c.plotLeft, f = b.chartY - f[1] - c.plotTop;
d[e ? "xAxis" : "yAxis"].push({
axis: a,
value: a.translate(e ? Math.PI - Math.atan2(n, f) : Math.sqrt(Math.pow(n, 2) + Math.pow(f, 2)), !0)
})
}) : d = a.call(this, b);
return d
})
})();
O(Q, {
Color: pa,
Point: Ga,
Tick: xa,
Renderer: lb,
SVGElement: ja,
SVGRenderer: lb,
arrayMin: D,
arrayMax: Ia,
charts: ra,
dateFormat: Pa,
error: L,
format: X,
pathAnim: {
init: function (a, b, c) {
b = b || "";
var d = a.shift, e = -1 < b.indexOf("C"), f = e ? 7 : 3, g;
b = b.split(" ");
c = [].concat(c);
var h, k, l = function (a) {
for (g = a.length; g--;) "M" === a[g] && a.splice(g + 1, 0, a[g + 1], a[g + 2], a[g + 1], a[g + 2])
};
e && (l(b), l(c));
a.isArea && (h = b.splice(b.length - 6, 6), k = c.splice(c.length - 6, 6));
if (d <= c.length / f && b.length === c.length) for (; d--;) c = [].concat(c).splice(0, f).concat(c);
a.shift = 0;
if (b.length) for (a = c.length; b.length < a;) d = [].concat(b).splice(b.length -
f, f), e && (d[f - 6] = d[f - 2], d[f - 5] = d[f - 1]), b = b.concat(d);
h && (b = b.concat(h), c = c.concat(k));
return [b, c]
}, step: function (a, b, c, d) {
var e = [], f = a.length;
if (1 === c) e = d; else if (f === b.length && 1 > c) for (; f--;) d = parseFloat(a[f]), e[f] = isNaN(d) ? a[f] : c * parseFloat(b[f] - d) + d; else e = b;
return e
}
},
getOptions: function () {
return la
},
hasBidiBug: Sb,
isTouchDevice: Jb,
setOptions: function (a) {
la = A(!0, la, a);
Db();
return la
},
addEvent: ga,
removeEvent: ma,
createElement: ca,
discardElement: gb,
css: E,
each: t,
map: Ea,
merge: A,
splat: S,
stableSort: fb,
extendClass: C,
pInt: F,
svg: sa,
canvas: za,
vml: !sa && !za,
product: "Highcharts 4.2.1",
version: "/Highstock 4.2.1"
});
return Q
});
(function (v) {
"object" === typeof module && module.exports ? module.exports = v : v(Highcharts)
})(function (v) {
var L = v.win, ba = L.document, A = v.Chart, F = v.addEvent, ha = v.removeEvent, W = v.fireEvent,
ia = v.createElement, r = v.discardElement, p = v.css, P = v.merge, M = v.each, u = v.extend, B = v.splat,
S = Math.max, oa = v.isTouchDevice, E = v.Renderer.prototype.symbols, ca = v.getOptions(), C;
u(ca.lang, {
printChart: "Print chart",
downloadPNG: "Download PNG image",
downloadJPEG: "Download JPEG image",
downloadPDF: "Download PDF document",
downloadSVG: "Download SVG vector image",
contextButtonTitle: "Chart context menu"
});
ca.navigation = {
menuStyle: {border: "1px solid #A0A0A0", background: "#FFFFFF", padding: "5px 0"},
menuItemStyle: {padding: "0 10px", background: "none", color: "#303030", fontSize: oa ? "14px" : "11px"},
menuItemHoverStyle: {background: "#4572A5", color: "#FFFFFF"},
buttonOptions: {
symbolFill: "#E0E0E0",
symbolSize: 14,
symbolStroke: "#666",
symbolStrokeWidth: 3,
symbolX: 12.5,
symbolY: 10.5,
align: "right",
buttonSpacing: 3,
height: 22,
theme: {fill: "white", stroke: "none"},
verticalAlign: "top",
width: 24
}
};
ca.exporting = {
type: "image/png", url: "http://export.highcharts.com/", buttons: {
contextButton: {
menuClassName: "highcharts-contextmenu", symbol: "menu", _titleKey: "contextButtonTitle", menuItems: [{
textKey: "printChart", onclick: function () {
this.print()
}
}, {separator: !0}, {
textKey: "downloadPNG", onclick: function () {
this.exportChart()
}
}, {
textKey: "downloadJPEG", onclick: function () {
this.exportChart({type: "image/jpeg"})
}
}, {
textKey: "downloadPDF", onclick: function () {
this.exportChart({type: "application/pdf"})
}
}, {
textKey: "downloadSVG", onclick: function () {
this.exportChart({type: "image/svg+xml"})
}
}]
}
}
};
v.post = function (n, q, p) {
var C;
n = ia("form", P({method: "post", action: n, enctype: "multipart/form-data"}, p), {display: "none"}, ba.body);
for (C in q) ia("input", {type: "hidden", name: C, value: q[C]}, null, n);
n.submit();
r(n)
};
u(A.prototype, {
sanitizeSVG: function (n) {
return n.replace(/zIndex="[^"]+"/g, "").replace(/isShadow="[^"]+"/g, "").replace(/symbolName="[^"]+"/g, "").replace(/jQuery[0-9]+="[^"]+"/g, "").replace(/url\([^#]+#/g, "url(#").replace(/.*?$/, " ").replace(/(fill|stroke)="rgba\(([ 0-9]+,[ 0-9]+,[ 0-9]+),([ 0-9\.]+)\)"/g, '$1="rgb($2)" $1-opacity="$3"').replace(/ /g, "\u00a0").replace(//g, "\u00ad").replace(/ /g, "<$1title>").replace(/height=([^" ]+)/g, 'height="$1"').replace(/width=([^" ]+)/g, 'width="$1"').replace(/hc-svg-href="([^"]+)">/g, 'xlink:href="$1"/>').replace(/ id=([^" >]+)/g, ' id="$1"').replace(/class=([^" >]+)/g, 'class="$1"').replace(/ transform /g, " ").replace(/:(path|rect)/g, "$1").replace(/style="([^"]+)"/g, function (n) {
return n.toLowerCase()
})
}, getChartHTML: function () {
return this.container.innerHTML
}, getSVG: function (n) {
var q = this, p, C, N, E, S, D = P(q.options, n), A = D.exporting.allowHTML;
ba.createElementNS || (ba.createElementNS = function (n, q) {
return ba.createElement(q)
});
C = ia("div", null, {
position: "absolute",
top: "-9999em",
width: q.chartWidth + "px",
height: q.chartHeight + "px"
}, ba.body);
N = q.renderTo.style.width;
S = q.renderTo.style.height;
N = D.exporting.sourceWidth || D.chart.width || /px$/.test(N) && parseInt(N, 10) || 600;
S = D.exporting.sourceHeight || D.chart.height || /px$/.test(S) && parseInt(S, 10) || 400;
u(D.chart, {animation: !1, renderTo: C, forExport: !0, renderer: "SVGRenderer", width: N, height: S});
D.exporting.enabled = !1;
delete D.data;
D.series = [];
M(q.series, function (n) {
E = P(n.options, {animation: !1, enableMouseTracking: !1, showCheckbox: !1, visible: n.visible});
E.isInternal || D.series.push(E)
});
n && M(["xAxis", "yAxis"], function (q) {
M(B(n[q]), function (n, p) {
D[q][p] = P(D[q][p], n)
})
});
p = new v.Chart(D, q.callback);
M(["xAxis", "yAxis"], function (n) {
M(q[n], function (q, r) {
var C = p[n][r], u = q.getExtremes(), v = u.userMin, u = u.userMax;
!C || void 0 === v && void 0 === u || C.setExtremes(v, u, !0, !1)
})
});
N = p.getChartHTML();
D = null;
p.destroy();
r(C);
A && (C = N.match(/<\/svg>(.*?$)/)) && (C = '' + C[1] + " ", N = N.replace("", C + ""));
N = this.sanitizeSVG(N);
return N = N.replace(/(url\(#highcharts-[0-9]+)"/g, "$1").replace(/"/g, "'")
}, getSVGForExport: function (n, q) {
var p = this.options.exporting;
return this.getSVG(P({chart: {borderRadius: 0}}, p.chartOptions, q, {
exporting: {
sourceWidth: n && n.sourceWidth || p.sourceWidth,
sourceHeight: n && n.sourceHeight || p.sourceHeight
}
}))
}, exportChart: function (n, q) {
var p = this.getSVGForExport(n, q);
n = P(this.options.exporting, n);
v.post(n.url, {
filename: n.filename || "chart",
type: n.type,
width: n.width || 0,
scale: n.scale || 2,
svg: p
}, n.formAttributes)
}, print: function () {
var n = this, q = n.container, p = [], r = q.parentNode, C = ba.body, u = C.childNodes;
n.isPrinting || (n.isPrinting = !0, n.pointer.reset(null, 0), W(n, "beforePrint"), M(u, function (n, q) {
1 === n.nodeType && (p[q] = n.style.display, n.style.display = "none")
}), C.appendChild(q), L.focus(), L.print(), setTimeout(function () {
r.appendChild(q);
M(u, function (n, q) {
1 === n.nodeType && (n.style.display = p[q])
});
n.isPrinting = !1;
W(n, "afterPrint")
}, 1E3))
}, contextMenu: function (n, q, r, C, v, B, P) {
var D = this, E = D.options.navigation, A = E.menuItemStyle, ca = D.chartWidth, oa = D.chartHeight,
W = "cache-" + n, L = D[W], pa = S(v, B), ja, xa, Xa, Ya = function (q) {
D.pointer.inClass(q.target, n) || xa()
};
L || (D[W] = L = ia("div", {className: n}, {
position: "absolute",
zIndex: 1E3,
padding: pa + "px"
}, D.container), ja = ia("div", null, u({
MozBoxShadow: "3px 3px 10px #888",
WebkitBoxShadow: "3px 3px 10px #888",
boxShadow: "3px 3px 10px #888"
}, E.menuStyle), L), xa = function () {
p(L, {display: "none"});
P && P.setState(0);
D.openMenu = !1
}, F(L, "mouseleave", function () {
Xa = setTimeout(xa, 500)
}), F(L, "mouseenter", function () {
clearTimeout(Xa)
}), F(ba, "mouseup", Ya), F(D, "destroy", function () {
ha(ba, "mouseup", Ya)
}), M(q, function (n) {
if (n) {
var q = n.separator ? ia("hr", null, null, ja) : ia("div", {
onmouseover: function () {
p(this, E.menuItemHoverStyle)
}, onmouseout: function () {
p(this, A)
}, onclick: function (q) {
q && q.stopPropagation();
xa();
n.onclick && n.onclick.apply(D, arguments)
}, innerHTML: n.text || D.options.lang[n.textKey]
}, u({cursor: "pointer"}, A), ja);
D.exportDivElements.push(q)
}
}), D.exportDivElements.push(ja, L), D.exportMenuWidth = L.offsetWidth, D.exportMenuHeight = L.offsetHeight);
q = {display: "block"};
r + D.exportMenuWidth > ca ? q.right = ca - r - v - pa + "px" : q.left = r - pa + "px";
C + B + D.exportMenuHeight > oa && "top" !== P.alignOptions.verticalAlign ? q.bottom = oa - C - pa + "px" : q.top = C + B - pa + "px";
p(L, q);
D.openMenu = !0
}, addButton: function (n) {
var q = this, p = q.renderer, r = P(q.options.navigation.buttonOptions, n), B = r.onclick, M = r.menuItems,
E, D, S = {stroke: r.symbolStroke, fill: r.symbolFill}, A = r.symbolSize || 12;
q.btnCount || (q.btnCount = 0);
q.exportDivElements || (q.exportDivElements = [], q.exportSVGElements = []);
if (!1 !== r.enabled) {
var F = r.theme, ca = F.states, oa = ca && ca.hover, ca = ca && ca.select, L;
delete F.states;
B ? L = function (n) {
n.stopPropagation();
B.call(q, n)
} : M && (L = function () {
q.contextMenu(D.menuClassName, M, D.translateX, D.translateY, D.width, D.height, D);
D.setState(2)
});
r.text && r.symbol ? F.paddingLeft = v.pick(F.paddingLeft, 25) : r.text || u(F, {
width: r.width,
height: r.height,
padding: 0
});
D = p.button(r.text, 0, 0, L, F, oa, ca).attr({
title: q.options.lang[r._titleKey],
"stroke-linecap": "round"
});
D.menuClassName = n.menuClassName || "highcharts-menu-" + q.btnCount++;
r.symbol && (E = p.symbol(r.symbol, r.symbolX - A / 2, r.symbolY - A / 2, A, A).attr(u(S, {
"stroke-width": r.symbolStrokeWidth || 1,
zIndex: 1
})).add(D));
D.add().align(u(r, {width: D.width, x: v.pick(r.x, C)}), !0, "spacingBox");
C += (D.width + r.buttonSpacing) * ("right" === r.align ? -1 : 1);
q.exportSVGElements.push(D, E)
}
}, destroyExport: function (n) {
n = n.target;
var q, p;
for (q = 0; q < n.exportSVGElements.length; q++) if (p = n.exportSVGElements[q]) p.onclick = p.ontouchstart = null, n.exportSVGElements[q] = p.destroy();
for (q = 0; q < n.exportDivElements.length; q++) p = n.exportDivElements[q], ha(p, "mouseleave"), n.exportDivElements[q] = p.onmouseout = p.onmouseover = p.ontouchstart = p.onclick = null, r(p)
}
});
E.menu = function (n, q, r, p) {
return ["M", n, q + 2.5, "L", n + r, q + 2.5, "M", n, q + p / 2 + .5, "L", n + r, q + p / 2 + .5, "M", n, q + p - 1.5, "L", n + r, q + p - 1.5]
};
A.prototype.callbacks.push(function (n) {
var q, r = n.options.exporting, p = r.buttons;
C = 0;
if (!1 !== r.enabled) {
for (q in p) n.addButton(p[q]);
F(n, "destroy", n.destroyExport)
}
})
});
(function (v) {
"object" === typeof module && module.exports ? module.exports = v : v(Highcharts)
})(function (v) {
var L = v.win.document, ba = v.each, A = v.pick, F = v.inArray, ha = v.splat, W, ia = function (r, p) {
this.init(r, p)
};
v.extend(ia.prototype, {
init: function (r, p) {
this.options = r;
this.chartOptions = p;
this.columns = r.columns || this.rowsToColumns(r.rows) || [];
this.firstRowAsNames = A(r.firstRowAsNames, !0);
this.decimalRegex = r.decimalPoint && new RegExp("^(-?[0-9]+)" + r.decimalPoint + "([0-9]+)$");
this.rawColumns = [];
this.columns.length ? this.dataFound() : (this.parseCSV(), this.parseTable(), this.parseGoogleSpreadsheet())
}, getColumnDistribution: function () {
var r = this.chartOptions, p = this.options, P = [], M = function (r) {
return (v.seriesTypes[r || "line"].prototype.pointArrayMap || [0]).length
}, u = r && r.chart && r.chart.type, B = [], S = [], A = 0, E;
ba(r && r.series || [], function (r) {
B.push(M(r.type || u))
});
ba(p && p.seriesMapping || [], function (r) {
P.push(r.x || 0)
});
0 === P.length && P.push(0);
ba(p && p.seriesMapping || [], function (p) {
var C = new W, n, q = B[A] || M(u),
H = v.seriesTypes[((r && r.series || [])[A] || {}).type || u || "line"].prototype.pointArrayMap || ["y"];
C.addColumnReader(p.x, "x");
for (n in p) p.hasOwnProperty(n) && "x" !== n && C.addColumnReader(p[n], n);
for (E = 0; E < q; E++) C.hasReader(H[E]) || C.addColumnReader(void 0, H[E]);
S.push(C);
A++
});
p = v.seriesTypes[u || "line"].prototype.pointArrayMap;
void 0 === p && (p = ["y"]);
this.valueCount = {global: M(u), xColumns: P, individual: B, seriesBuilders: S, globalPointArrayMap: p}
}, dataFound: function () {
this.options.switchRowsAndColumns && (this.columns = this.rowsToColumns(this.columns));
this.getColumnDistribution();
this.parseTypes();
!1 !== this.parsed() && this.complete()
}, parseCSV: function () {
var r = this, p = this.options, v = p.csv, M = this.columns, u = p.startRow || 0,
B = p.endRow || Number.MAX_VALUE, A = p.startColumn || 0, F = p.endColumn || Number.MAX_VALUE, E, ca,
C = 0;
v && (ca = v.replace(/\r\n/g, "\n").replace(/\r/g, "\n").split(p.lineDelimiter || "\n"), E = p.itemDelimiter || (-1 !== v.indexOf("\t") ? "\t" : ","), ba(ca, function (n, q) {
var p = r.trim(n), v = 0 === p.indexOf("#");
q >= u && q <= B && !v && "" !== p && (p = n.split(E), ba(p, function (n, q) {
q >= A && q <= F && (M[q - A] || (M[q - A] = []), M[q - A][C] = n)
}), C += 1)
}), this.dataFound())
}, parseTable: function () {
var r = this.options, p = r.table, v = this.columns, M = r.startRow || 0, u = r.endRow || Number.MAX_VALUE,
B = r.startColumn || 0, A = r.endColumn || Number.MAX_VALUE;
p && ("string" === typeof p && (p = L.getElementById(p)), ba(p.getElementsByTagName("tr"), function (p, r) {
r >= M && r <= u && ba(p.children, function (p, C) {
("TD" === p.tagName || "TH" === p.tagName) && C >= B && C <= A && (v[C - B] || (v[C - B] = []), v[C - B][r - M] = p.innerHTML)
})
}), this.dataFound())
}, parseGoogleSpreadsheet: function () {
var r = this, p = this.options, v = p.googleSpreadsheetKey, M = this.columns, u = p.startRow || 0,
B = p.endRow || Number.MAX_VALUE, A = p.startColumn || 0, F = p.endColumn || Number.MAX_VALUE, E, L;
v && jQuery.ajax({
dataType: "json",
url: "https://spreadsheets.google.com/feeds/cells/" + v + "/" + (p.googleSpreadsheetWorksheet || "od6") + "/public/values?alt=json-in-script&callback=?",
error: p.error,
success: function (p) {
p = p.feed.entry;
var n, q = p.length, v = 0, P = 0, N;
for (N = 0; N < q; N++) n = p[N], v = Math.max(v, n.gs$cell.col), P = Math.max(P, n.gs$cell.row);
for (N = 0; N < v; N++) N >= A && N <= F && (M[N - A] = [], M[N - A].length = Math.min(P, B - u));
for (N = 0; N < q; N++) n = p[N], E = n.gs$cell.row - 1, L = n.gs$cell.col - 1, L >= A && L <= F && E >= u && E <= B && (M[L - A][E - u] = n.content.$t);
r.dataFound()
}
})
}, trim: function (r, p) {
"string" === typeof r && (r = r.replace(/^\s+|\s+$/g, ""), p && /^[0-9\s]+$/.test(r) && (r = r.replace(/\s/g, "")), this.decimalRegex && (r = r.replace(this.decimalRegex, "$1.$2")));
return r
}, parseTypes: function () {
for (var r = this.columns, p = r.length; p--;) this.parseColumn(r[p], p)
}, parseColumn: function (r, p) {
var v = this.rawColumns, M = this.columns, u = r.length, B, A, L, E, W = this.firstRowAsNames,
C = -1 !== F(p, this.valueCount.xColumns), n = [], q = this.chartOptions, H,
X = (this.options.columnTypes || [])[p],
q = C && (q && q.xAxis && "category" === ha(q.xAxis)[0].type || "string" === X);
for (v[p] || (v[p] = []); u--;) B = n[u] || r[u], L = this.trim(B), E = this.trim(B, !0), A = parseFloat(E), void 0 === v[p][u] && (v[p][u] = L), q || 0 === u && W ? r[u] = L : +E === A ? (r[u] = A, 31536E6 < A && "float" !== X ? r.isDatetime = !0 : r.isNumeric = !0, void 0 !== r[u + 1] && (H = A > r[u + 1])) : (A = this.parseDate(B), C && "number" === typeof A && !isNaN(A) && "float" !== X ? (n[u] = B, r[u] = A, r.isDatetime = !0, void 0 !== r[u + 1] && (B = A > r[u + 1], B !== H && void 0 !== H && (this.alternativeFormat ? (this.dateFormat = this.alternativeFormat, u = r.length, this.alternativeFormat = this.dateFormats[this.dateFormat].alternative) : r.unsorted = !0), H = B)) : (r[u] = "" === L ? null : L, 0 !== u && (r.isDatetime || r.isNumeric) && (r.mixed = !0)));
C && r.mixed && (M[p] = v[p]);
if (C && H && this.options.sort) for (p = 0; p < M.length; p++) M[p].reverse(), W && M[p].unshift(M[p].pop())
}, dateFormats: {
"YYYY-mm-dd": {
regex: /^([0-9]{4})[\-\/\.]([0-9]{2})[\-\/\.]([0-9]{2})$/, parser: function (r) {
return Date.UTC(+r[1], r[2] - 1, +r[3])
}
}, "dd/mm/YYYY": {
regex: /^([0-9]{1,2})[\-\/\.]([0-9]{1,2})[\-\/\.]([0-9]{4})$/, parser: function (r) {
return Date.UTC(+r[3], r[2] - 1, +r[1])
}, alternative: "mm/dd/YYYY"
}, "mm/dd/YYYY": {
regex: /^([0-9]{1,2})[\-\/\.]([0-9]{1,2})[\-\/\.]([0-9]{4})$/, parser: function (r) {
return Date.UTC(+r[3], r[1] - 1, +r[2])
}
}, "dd/mm/YY": {
regex: /^([0-9]{1,2})[\-\/\.]([0-9]{1,2})[\-\/\.]([0-9]{2})$/, parser: function (r) {
return Date.UTC(+r[3] + 2E3, r[2] - 1, +r[1])
}, alternative: "mm/dd/YY"
}, "mm/dd/YY": {
regex: /^([0-9]{1,2})[\-\/\.]([0-9]{1,2})[\-\/\.]([0-9]{2})$/, parser: function (r) {
return Date.UTC(+r[3] + 2E3, r[1] - 1, +r[2])
}
}
}, parseDate: function (r) {
var p = this.options.parseDate, v, A, u = this.options.dateFormat || this.dateFormat, B;
if (p) v = p(r); else if ("string" === typeof r) {
if (u) p = this.dateFormats[u], (B = r.match(p.regex)) && (v = p.parser(B)); else for (A in this.dateFormats) if (p = this.dateFormats[A], B = r.match(p.regex)) {
this.dateFormat = A;
this.alternativeFormat = p.alternative;
v = p.parser(B);
break
}
B || (B = Date.parse(r), "object" === typeof B && null !== B && B.getTime ? v = B.getTime() - 6E4 * B.getTimezoneOffset() : "number" !== typeof B || isNaN(B) || (v = B - 6E4 * (new Date(B)).getTimezoneOffset()))
}
return v
}, rowsToColumns: function (r) {
var p, v, A, u, B;
if (r) for (B = [], v = r.length, p = 0; p < v; p++) for (u = r[p].length, A = 0; A < u; A++) B[A] || (B[A] = []), B[A][p] = r[p][A];
return B
}, parsed: function () {
if (this.options.parsed) return this.options.parsed.call(this, this.columns)
}, getFreeIndexes: function (r, p) {
var v, A, u = [], B = [], F;
for (A = 0; A < r; A += 1) u.push(!0);
for (v = 0; v < p.length; v += 1) for (F = p[v].getReferencedColumnIndexes(), A = 0; A < F.length; A += 1) u[F[A]] = !1;
for (A = 0; A < u.length; A += 1) u[A] && B.push(A);
return B
}, complete: function () {
var r = this.columns, p, v = this.options, A, u, B, S, L = [], E;
if (v.complete || v.afterComplete) {
for (B = 0; B < r.length; B++) this.firstRowAsNames && (r[B].name = r[B].shift());
A = [];
u = this.getFreeIndexes(r.length, this.valueCount.seriesBuilders);
for (B = 0; B < this.valueCount.seriesBuilders.length; B++) E = this.valueCount.seriesBuilders[B], E.populateColumns(u) && L.push(E);
for (; 0 < u.length;) {
E = new W;
E.addColumnReader(0, "x");
B = F(0, u);
-1 !== B && u.splice(B, 1);
for (B = 0; B < this.valueCount.global; B++) E.addColumnReader(void 0, this.valueCount.globalPointArrayMap[B]);
E.populateColumns(u) && L.push(E)
}
0 < L.length && 0 < L[0].readers.length && (E = r[L[0].readers[0].columnIndex], void 0 !== E && (E.isDatetime ? p = "datetime" : E.isNumeric || (p = "category")));
if ("category" === p) for (B = 0; B < L.length; B++) for (E = L[B], u = 0; u < E.readers.length; u++) "x" === E.readers[u].configName && (E.readers[u].configName = "name");
for (B = 0; B < L.length; B++) {
E = L[B];
u = [];
for (S = 0; S < r[0].length; S++) u[S] = E.read(r, S);
A[B] = {data: u};
E.name && (A[B].name = E.name);
"category" === p && (A[B].turboThreshold = 0)
}
r = {series: A};
p && (r.xAxis = {type: p});
v.complete && v.complete(r);
v.afterComplete && v.afterComplete(r)
}
}
});
v.Data = ia;
v.data = function (r, p) {
return new ia(r, p)
};
v.wrap(v.Chart.prototype, "init", function (r, p, A) {
var F = this;
p && p.data ? v.data(v.extend(p.data, {
afterComplete: function (u) {
var B, L;
if (p.hasOwnProperty("series")) if ("object" === typeof p.series) for (B = Math.max(p.series.length, u.series.length); B--;) L = p.series[B] || {}, p.series[B] = v.merge(L, u.series[B]); else delete p.series;
p = v.merge(u, p);
r.call(F, p, A)
}
}), p) : r.call(F, p, A)
});
W = function () {
this.readers = [];
this.pointIsArray = !0
};
W.prototype.populateColumns = function (r) {
var p = !0;
ba(this.readers, function (p) {
void 0 === p.columnIndex && (p.columnIndex = r.shift())
});
ba(this.readers, function (r) {
void 0 === r.columnIndex && (p = !1)
});
return p
};
W.prototype.read = function (r, p) {
var v = this.pointIsArray, A = v ? [] : {}, u;
ba(this.readers, function (u) {
var F = r[u.columnIndex][p];
v ? A.push(F) : A[u.configName] = F
});
void 0 === this.name && 2 <= this.readers.length && (u = this.getReferencedColumnIndexes(), 2 <= u.length && (u.shift(), u.sort(), this.name = r[u.shift()].name));
return A
};
W.prototype.addColumnReader = function (r, p) {
this.readers.push({columnIndex: r, configName: p});
"x" !== p && "y" !== p && void 0 !== p && (this.pointIsArray = !1)
};
W.prototype.getReferencedColumnIndexes = function () {
var r, p = [], v;
for (r = 0; r < this.readers.length; r += 1) v = this.readers[r], void 0 !== v.columnIndex && p.push(v.columnIndex);
return p
};
W.prototype.hasReader = function (r) {
var p, v;
for (p = 0; p < this.readers.length; p += 1) if (v = this.readers[p], v.configName === r) return !0
}
});
(function (v) {
"object" === typeof module && module.exports ? module.exports = v : v(Highcharts)
})(function (v) {
function L() {
return !!this.points.length
}
function ba() {
this.hasData() ? this.hideNoData() : this.showNoData()
}
var A = v.seriesTypes, F = v.Chart.prototype, ha = v.getOptions(), W = v.extend, ia = v.each;
W(ha.lang, {noData: "No data to display"});
ha.noData = {
position: {x: 0, y: 0, align: "center", verticalAlign: "middle"},
attr: {},
style: {fontWeight: "bold", fontSize: "12px", color: "#60606a"}
};
ia(["pie", "gauge", "waterfall", "bubble"], function (r) {
A[r] && (A[r].prototype.hasData = L)
});
v.Series.prototype.hasData = function () {
return this.visible && void 0 !== this.dataMax && void 0 !== this.dataMin
};
F.showNoData = function (r) {
var p = this.options;
r = r || p.lang.noData;
p = p.noData;
this.noDataLabel || (this.noDataLabel = this.renderer.label(r, 0, 0, null, null, null, p.useHTML, null, "no-data").attr(p.attr).css(p.style).add(), this.noDataLabel.align(W(this.noDataLabel.getBBox(), p.position), !1, "plotBox"))
};
F.hideNoData = function () {
this.noDataLabel && (this.noDataLabel = this.noDataLabel.destroy())
};
F.hasData = function () {
for (var r = this.series, p = r.length; p--;) if (r[p].hasData() && !r[p].options.isInternal) return !0;
return !1
};
F.callbacks.push(function (r) {
v.addEvent(r, "load", ba);
v.addEvent(r, "redraw", ba)
})
});
(function (v) {
"object" === typeof module && module.exports ? module.exports = v : v(Highcharts)
})(function (v) {
function L(p, n, q) {
var r;
n.rgba.length && p.rgba.length ? (p = p.rgba, n = n.rgba, r = 1 !== n[3] || 1 !== p[3], p = (r ? "rgba(" : "rgb(") + Math.round(n[0] + (p[0] - n[0]) * (1 - q)) + "," + Math.round(n[1] + (p[1] - n[1]) * (1 - q)) + "," + Math.round(n[2] + (p[2] - n[2]) * (1 - q)) + (r ? "," + (n[3] + (p[3] - n[3]) * (1 - q)) : "") + ")") : p = n.input || "none";
return p
}
var ba = function () {
}, A = v.getOptions(), F = v.each, ha = v.extend, W = v.format, ia = v.pick, r = v.wrap, p = v.Chart,
P = v.seriesTypes, M = P.pie, u = P.column, B = v.Tick, S = v.fireEvent, oa = v.inArray, E = 1;
F(["fill", "stroke"], function (p) {
v.Fx.prototype[p + "Setter"] = function () {
this.elem.attr(p, L(v.Color(this.start), v.Color(this.end), this.pos))
}
});
ha(A.lang, {drillUpText: "\u25c1 Back to {series.name}"});
A.drilldown = {
activeAxisLabelStyle: {
cursor: "pointer",
color: "#0d233a",
fontWeight: "bold",
textDecoration: "underline"
},
activeDataLabelStyle: {cursor: "pointer", color: "#0d233a", fontWeight: "bold", textDecoration: "underline"},
animation: {duration: 500},
drillUpButton: {position: {align: "right", x: -10, y: 10}}
};
v.SVGRenderer.prototype.Element.prototype.fadeIn = function (p) {
this.attr({opacity: .1, visibility: "inherit"}).animate({opacity: ia(this.newOpacity, 1)}, p || {duration: 250})
};
p.prototype.addSeriesAsDrilldown = function (p, n) {
this.addSingleSeriesAsDrilldown(p, n);
this.applyDrilldown()
};
p.prototype.addSingleSeriesAsDrilldown = function (p, n) {
var q = p.series, r = q.xAxis, v = q.yAxis, u;
u = p.color || q.color;
var A, B = [], D = [], L, M;
this.drilldownLevels || (this.drilldownLevels = []);
L = q.options._levelNumber || 0;
(M = this.drilldownLevels[this.drilldownLevels.length -
1]) && M.levelNumber !== L && (M = void 0);
n = ha({color: u, _ddSeriesId: E++}, n);
A = oa(p, q.points);
F(q.chart.series, function (n) {
n.xAxis !== r || n.isDrilling || (n.options._ddSeriesId = n.options._ddSeriesId || E++, n.options._colorIndex = n.userOptions._colorIndex, n.options._levelNumber = n.options._levelNumber || L, M ? (B = M.levelSeries, D = M.levelSeriesOptions) : (B.push(n), D.push(n.options)))
});
u = {
levelNumber: L,
seriesOptions: q.options,
levelSeriesOptions: D,
levelSeries: B,
shapeArgs: p.shapeArgs,
bBox: p.graphic ? p.graphic.getBBox() : {},
color: u,
lowerSeriesOptions: n,
pointOptions: q.options.data[A],
pointIndex: A,
oldExtremes: {xMin: r && r.userMin, xMax: r && r.userMax, yMin: v && v.userMin, yMax: v && v.userMax}
};
this.drilldownLevels.push(u);
u = u.lowerSeries = this.addSeries(n, !1);
u.options._levelNumber = L + 1;
r && (r.oldPos = r.pos, r.userMin = r.userMax = null, v.userMin = v.userMax = null);
q.type === u.type && (u.animate = u.animateDrilldown || ba, u.options.animation = !0)
};
p.prototype.applyDrilldown = function () {
var p = this.drilldownLevels, n;
p && 0 < p.length && (n = p[p.length - 1].levelNumber, F(this.drilldownLevels, function (q) {
q.levelNumber === n && F(q.levelSeries, function (q) {
q.options && q.options._levelNumber === n && q.remove(!1)
})
}));
this.redraw();
this.showDrillUpButton()
};
p.prototype.getDrilldownBackText = function () {
var p = this.drilldownLevels;
if (p && 0 < p.length) return p = p[p.length - 1], p.series = p.seriesOptions, W(this.options.lang.drillUpText, p)
};
p.prototype.showDrillUpButton = function () {
var p = this, n = this.getDrilldownBackText(), q = p.options.drilldown.drillUpButton, r, v;
this.drillUpButton ? this.drillUpButton.attr({text: n}).align() : (v = (r = q.theme) && r.states, this.drillUpButton = this.renderer.button(n, null, null, function () {
p.drillUp()
}, r, v && v.hover, v && v.select).attr({
align: q.position.align,
zIndex: 9
}).add().align(q.position, !1, q.relativeTo || "plotBox"))
};
p.prototype.drillUp = function () {
for (var p = this, n = p.drilldownLevels, q = n[n.length - 1].levelNumber, r = n.length, v = p.series, u, A, B, D, E = function (n) {
var q;
F(v, function (p) {
p.options._ddSeriesId === n._ddSeriesId && (q = p)
});
q = q || p.addSeries(n, !1);
q.type === B.type && q.animateDrillupTo && (q.animate = q.animateDrillupTo);
n === A.seriesOptions && (D = q)
}; r--;) if (A = n[r], A.levelNumber === q) {
n.pop();
B = A.lowerSeries;
if (!B.chart) for (u = v.length; u--;) if (v[u].options.id === A.lowerSeriesOptions.id && v[u].options._levelNumber === q + 1) {
B = v[u];
break
}
B.xData = [];
F(A.levelSeriesOptions, E);
S(p, "drillup", {seriesOptions: A.seriesOptions});
D.type === B.type && (D.drilldownLevel = A, D.options.animation = p.options.drilldown.animation, B.animateDrillupFrom && B.chart && B.animateDrillupFrom(A));
D.options._levelNumber = q;
B.remove(!1);
D.xAxis && (u = A.oldExtremes, D.xAxis.setExtremes(u.xMin, u.xMax, !1), D.yAxis.setExtremes(u.yMin, u.yMax, !1))
}
this.redraw();
0 === this.drilldownLevels.length ? this.drillUpButton = this.drillUpButton.destroy() : this.drillUpButton.attr({text: this.getDrilldownBackText()}).align();
this.ddDupes.length = []
};
u.prototype.supportsDrilldown = !0;
u.prototype.animateDrillupTo = function (p) {
if (!p) {
var n = this, q = n.drilldownLevel;
F(this.points, function (n) {
n.graphic && n.graphic.hide();
n.dataLabel && n.dataLabel.hide();
n.connector && n.connector.hide()
});
setTimeout(function () {
n.points && F(n.points, function (n, p) {
var r = p === (q && q.pointIndex) ? "show" : "fadeIn", v = "show" === r ? !0 : void 0;
if (n.graphic) n.graphic[r](v);
if (n.dataLabel) n.dataLabel[r](v);
if (n.connector) n.connector[r](v)
})
}, Math.max(this.chart.options.drilldown.animation.duration - 50, 0));
this.animate = ba
}
};
u.prototype.animateDrilldown = function (p) {
var n = this, q = this.chart.drilldownLevels, r, v = this.chart.options.drilldown.animation, u = this.xAxis;
p || (F(q, function (q) {
n.options._ddSeriesId === q.lowerSeriesOptions._ddSeriesId && (r = q.shapeArgs, r.fill = q.color)
}), r.x += ia(u.oldPos, u.pos) - u.pos, F(this.points, function (n) {
n.graphic && n.graphic.attr(r).animate(ha(n.shapeArgs, {fill: n.color}), v);
n.dataLabel && n.dataLabel.fadeIn(v)
}), this.animate = null)
};
u.prototype.animateDrillupFrom = function (p) {
var n = this.chart.options.drilldown.animation, q = this.group, r = this;
F(r.trackerGroups, function (n) {
if (r[n]) r[n].on("mouseover")
});
delete this.group;
F(this.points, function (r) {
var u = r.graphic, A = function () {
u.destroy();
q && (q = q.destroy())
};
u && (delete r.graphic, n ? u.animate(ha(p.shapeArgs, {fill: p.color}), v.merge(n, {complete: A})) : (u.attr(p.shapeArgs), A()))
})
};
M && ha(M.prototype, {
supportsDrilldown: !0,
animateDrillupTo: u.prototype.animateDrillupTo,
animateDrillupFrom: u.prototype.animateDrillupFrom,
animateDrilldown: function (p) {
var n = this.chart.drilldownLevels[this.chart.drilldownLevels.length - 1],
q = this.chart.options.drilldown.animation, r = n.shapeArgs, u = r.start,
A = (r.end - u) / this.points.length;
p || (F(this.points, function (p, C) {
p.graphic.attr(v.merge(r, {
start: u + C * A,
end: u + (C + 1) * A,
fill: n.color
}))[q ? "animate" : "attr"](ha(p.shapeArgs, {fill: p.color}), q)
}), this.animate = null)
}
});
v.Point.prototype.doDrilldown = function (p, n) {
var q = this.series.chart, r = q.options.drilldown, v = (r.series || []).length, u;
q.ddDupes || (q.ddDupes = []);
for (; v-- && !u;) r.series[v].id === this.drilldown && -1 === oa(this.drilldown, q.ddDupes) && (u = r.series[v], q.ddDupes.push(this.drilldown));
S(q, "drilldown", {
point: this,
seriesOptions: u,
category: n,
points: void 0 !== n && this.series.xAxis.ddPoints[n].slice(0)
});
u && (p ? q.addSingleSeriesAsDrilldown(this, u) : q.addSeriesAsDrilldown(this, u))
};
v.Axis.prototype.drilldownCategory = function (p) {
var n, q, r = this.ddPoints[p];
for (n in r) (q = r[n]) && q.series && q.series.visible && q.doDrilldown && q.doDrilldown(!0, p);
this.chart.applyDrilldown()
};
v.Axis.prototype.getDDPoints = function (p, n) {
var q = this.ddPoints;
q || (this.ddPoints = q = {});
q[p] || (q[p] = []);
q[p].levelNumber !== n && (q[p].length = 0);
return q[p]
};
B.prototype.drillable = function () {
var p = this.pos, n = this.label, q = this.axis, r = q.ddPoints && q.ddPoints[p];
n && r && r.length ? (n.basicStyles || (n.basicStyles = v.merge(n.styles)), n.addClass("highcharts-drilldown-axis-label").css(q.chart.options.drilldown.activeAxisLabelStyle).on("click", function () {
q.drilldownCategory(p)
})) : n && n.basicStyles && (n.styles = {}, n.css(n.basicStyles), n.on("click", null))
};
r(B.prototype, "addLabel", function (p) {
p.call(this);
this.drillable()
});
r(v.Point.prototype, "init", function (p, n, q, r) {
var u = p.call(this, n, q, r);
p = (q = n.xAxis) && q.ticks[r];
q = q && q.getDDPoints(r, n.options._levelNumber);
u.drilldown && (v.addEvent(u, "click", function () {
n.xAxis && !1 === n.chart.options.drilldown.allowPointDrilldown ? n.xAxis.drilldownCategory(r) : u.doDrilldown()
}), q && (q.push(u), q.levelNumber = n.options._levelNumber));
p && p.drillable();
return u
});
r(v.Series.prototype, "drawDataLabels", function (p) {
var n = this.chart.options.drilldown.activeDataLabelStyle;
p.call(this);
F(this.points, function (p) {
p.drilldown && p.dataLabel && p.dataLabel.attr({"class": "highcharts-drilldown-data-label"}).css(n)
})
});
var ca, A = function (p) {
p.call(this);
F(this.points, function (n) {
n.drilldown && n.graphic && n.graphic.attr({"class": "highcharts-drilldown-point"}).css({cursor: "pointer"})
})
};
for (ca in P) P[ca].prototype.supportsDrilldown && r(P[ca].prototype, "drawTracker", A)
});
;
if (window.jQuery) (function ($) {
if ($.browser.msie) try {
document.execCommand("BackgroundImageCache", false, true)
} catch (e) {
}
;
$.fn.rating = function (options) {
if (this.length == 0) return this;
if (typeof arguments[0] == 'string') {
if (this.length > 1) {
var args = arguments;
return this.each(function () {
$.fn.rating.apply($(this), args);
});
}
;
$.fn.rating[arguments[0]].apply(this, $.makeArray(arguments).slice(1) || []);
return this;
}
;
var options = $.extend({}, $.fn.rating.options, options || {});
$.fn.rating.calls++;
this.not('.star-rating-applied').addClass('star-rating-applied').each(function () {
var control, input = $(this);
var eid = (this.name || 'unnamed-rating').replace(/\[|\]/g, '_').replace(/^\_+|\_+$/g, '');
var context = $(this.form || document.body);
var raters = context.data('rating');
if (!raters || raters.call != $.fn.rating.calls) raters = {count: 0, call: $.fn.rating.calls};
var rater = raters[eid];
if (rater) control = rater.data('rating');
if (rater && control)
control.count++; else {
control = $.extend({}, options || {}, ($.metadata ? input.metadata() : ($.meta ? input.data() : null)) || {}, {
count: 0,
stars: [],
inputs: []
});
control.serial = raters.count++;
rater = $(' ');
input.before(rater);
rater.addClass('rating-to-be-drawn');
if (input.attr('disabled') || input.hasClass('disabled')) control.readOnly = true;
if (input.hasClass('required')) control.required = true;
}
;
var star = $('');
rater.append(star);
if (this.id) star.attr('id', this.id);
if (this.className) star.addClass(this.className);
if (control.half) control.split = 2;
if (typeof control.split == 'number' && control.split > 0) {
var stw = ($.fn.width ? star.width() : 0) || control.starWidth;
var spi = (control.count % control.split), spw = Math.floor(stw / control.split);
star.width(spw).find('a').css({'margin-left': '-' + (spi * spw) + 'px'})
}
;
if (control.readOnly)
star.addClass('star-rating-readonly'); else
star.addClass('star-rating-live').mouseover(function () {
$(this).rating('fill');
$(this).rating('focus');
}).mouseout(function () {
$(this).rating('draw');
$(this).rating('blur');
}).click(function () {
$(this).rating('select');
});
if (this.checked) control.current = star;
if (this.nodeName == "A") {
if ($(this).hasClass('selected'))
control.current = star;
}
;
input.hide();
input.change(function () {
$(this).rating('select');
});
star.data('rating.input', input.data('rating.star', star));
control.stars[control.stars.length] = star[0];
control.inputs[control.inputs.length] = input[0];
control.rater = raters[eid] = rater;
control.context = context;
input.data('rating', control);
rater.data('rating', control);
star.data('rating', control);
context.data('rating', raters);
});
$('.rating-to-be-drawn').rating('draw').removeClass('rating-to-be-drawn');
return this;
};
$.extend($.fn.rating, {
calls: 0, focus: function () {
var control = this.data('rating');
if (!control) return this;
if (!control.focus) return this;
var input = $(this).data('rating.input') || $(this.tagName == 'INPUT' ? this : null);
if (control.focus) control.focus.apply(input[0], [input.val(), $('a', input.data('rating.star'))[0]]);
}, blur: function () {
var control = this.data('rating');
if (!control) return this;
if (!control.blur) return this;
var input = $(this).data('rating.input') || $(this.tagName == 'INPUT' ? this : null);
if (control.blur) control.blur.apply(input[0], [input.val(), $('a', input.data('rating.star'))[0]]);
}, fill: function () {
var control = this.data('rating');
if (!control) return this;
if (control.readOnly) return;
this.rating('drain');
this.prevAll().andSelf().filter('.rater-' + control.serial).addClass('star-rating-hover');
}, drain: function () {
var control = this.data('rating');
if (!control) return this;
if (control.readOnly) return;
control.rater.children().filter('.rater-' + control.serial).removeClass('star-rating-on').removeClass('star-rating-hover');
}, draw: function () {
var control = this.data('rating');
if (!control) return this;
this.rating('drain');
if (control.current) {
control.current.data('rating.input').attr('checked', 'checked');
control.current.prevAll().andSelf().filter('.rater-' + control.serial).addClass('star-rating-on');
}
else
$(control.inputs).removeAttr('checked');
this.siblings()[control.readOnly ? 'addClass' : 'removeClass']('star-rating-readonly');
}, select: function (value, wantCallBack) {
var control = this.data('rating');
if (!control) return this;
if (control.readOnly) return;
control.current = null;
if (typeof value != 'undefined') {
if (typeof value == 'number')
return $(control.stars[value]).rating('select', undefined, wantCallBack);
if (typeof value == 'string')
$.each(control.stars, function () {
if ($(this).data('rating.input').val() == value) $(this).rating('select', undefined, wantCallBack);
});
}
else
control.current = this[0].tagName == 'INPUT' ? this.data('rating.star') : (this.is('.rater-' + control.serial) ? this : null);
this.data('rating', control);
this.rating('draw');
var input = $(control.current ? control.current.data('rating.input') : null);
if ((wantCallBack || wantCallBack == undefined) && control.callback) control.callback.apply(input[0], [input.val(), $('a', control.current)[0]]);
}, readOnly: function (toggle, disable) {
var control = this.data('rating');
if (!control) return this;
control.readOnly = toggle || toggle == undefined ? true : false;
if (disable) $(control.inputs).attr("disabled", "disabled"); else $(control.inputs).removeAttr("disabled");
this.data('rating', control);
this.rating('draw');
}, disable: function () {
this.rating('readOnly', true, true);
}, enable: function () {
this.rating('readOnly', false, false);
}
});
$.fn.rating.options = {cancel: 'Cancel Rating', cancelValue: '', split: 0, starWidth: 16};
})(jQuery);
;
if (window.jQuery) (function ($) {
if ($.browser.msie) try {
document.execCommand("BackgroundImageCache", false, true)
} catch (e) {
}
;
$.fn.rating = function (options) {
if (this.length == 0) return this;
if (typeof arguments[0] == 'string') {
if (this.length > 1) {
var args = arguments;
return this.each(function () {
$.fn.rating.apply($(this), args);
});
}
;
$.fn.rating[arguments[0]].apply(this, $.makeArray(arguments).slice(1) || []);
return this;
}
;
var options = $.extend({}, $.fn.rating.options, options || {});
$.fn.rating.calls++;
this.not('.star-rating-applied').addClass('star-rating-applied').each(function (k, v) {
var control, input = $(this);
var eid = (this.name || 'unnamed-rating').replace(/\[|\]/g, '_').replace(/^\_+|\_+$/g, '');
var context = $(this.form || document.body);
var raters = context.data('rating');
if (!raters || raters.call != $.fn.rating.calls) raters = {count: 0, call: $.fn.rating.calls};
var rater = raters[eid];
if (rater) control = rater.data('rating');
if (rater && control)
control.count++; else {
control = $.extend({}, options || {}, ($.metadata ? input.metadata() : ($.meta ? input.data() : null)) || {}, {
count: 0,
stars: [],
inputs: []
});
control.serial = raters.count++;
rater = $(' ');
input.before(rater);
rater.addClass('rating-to-be-drawn');
if (input.attr('disabled') || input.hasClass('disabled')) control.readOnly = true;
if (input.hasClass('required')) control.required = true;
}
;
var star = $('');
rater.append(star);
if (this.id) star.attr('id', this.id);
if (this.className) star.addClass(this.className);
if (control.half) control.split = 2;
if (typeof control.split == 'number' && control.split > 0) {
var stw = ($.fn.width ? star.width() : 0) || control.starWidth;
var spi = (control.count % control.split), spw = Math.floor(stw / control.split);
star.width(spw).find('a').css({'margin-left': '-' + (spi * spw) + 'px'})
}
;
if (control.readOnly)
star.addClass('star-rating-readonly'); else
star.addClass('star-rating-live').mouseover(function () {
$(this).rating('fill');
$(this).rating('focus');
}).mouseout(function () {
$(this).rating('draw');
$(this).rating('blur');
}).click(function () {
$(this).rating('select');
});
if (this.checked) control.current = star;
if (this.nodeName == "A") {
if ($(this).hasClass('selected'))
control.current = star;
}
;
input.hide();
input.change(function () {
$(this).rating('select');
});
star.data('rating.input', input.data('rating.star', star));
control.stars[control.stars.length] = star[0];
control.inputs[control.inputs.length] = input[0];
control.rater = raters[eid] = rater;
control.context = context;
input.data('rating', control);
rater.data('rating', control);
star.data('rating', control);
context.data('rating', raters);
});
$('.rating-to-be-drawn').rating('draw').removeClass('rating-to-be-drawn');
return this;
};
$.extend($.fn.rating, {
calls: 0, focus: function () {
var control = this.data('rating');
if (!control) return this;
if (!control.focus) return this;
var input = $(this).data('rating.input') || $(this.tagName == 'INPUT' ? this : null);
if (control.focus) control.focus.apply(input[0], [input.val(), $('a', input.data('rating.star'))[0]]);
}, blur: function () {
var control = this.data('rating');
if (!control) return this;
if (!control.blur) return this;
var input = $(this).data('rating.input') || $(this.tagName == 'INPUT' ? this : null);
if (control.blur) control.blur.apply(input[0], [input.val(), $('a', input.data('rating.star'))[0]]);
}, fill: function () {
var control = this.data('rating');
if (!control) return this;
if (control.readOnly) return;
this.rating('drain');
this.prevAll().andSelf().filter('.rater-' + control.serial).addClass('star-rating-hover');
}, drain: function () {
var control = this.data('rating');
if (!control) return this;
if (control.readOnly) return;
control.rater.children().filter('.rater-' + control.serial).removeClass('star-rating-on').removeClass('star-rating-hover');
}, draw: function () {
var control = this.data('rating');
if (!control) return this;
this.rating('drain');
if (control.current) {
control.current.data('rating.input').attr('checked', 'checked');
control.current.prevAll().andSelf().filter('.rater-' + control.serial).addClass('star-rating-on');
}
else
$(control.inputs).removeAttr('checked');
this.siblings()[control.readOnly ? 'addClass' : 'removeClass']('star-rating-readonly');
}, select: function (value, wantCallBack) {
var control = this.data('rating');
if (!control) return this;
if (control.readOnly) return;
control.current = null;
if (typeof value != 'undefined') {
if (typeof value == 'number')
return $(control.stars[value]).rating('select', undefined, wantCallBack);
if (typeof value == 'string')
$.each(control.stars, function () {
if ($(this).data('rating.input').val() == value) $(this).rating('select', undefined, wantCallBack);
});
}
else
control.current = this[0].tagName == 'INPUT' ? this.data('rating.star') : (this.is('.rater-' + control.serial) ? this : null);
this.data('rating', control);
this.rating('draw');
var input = $(control.current ? control.current.data('rating.input') : null);
if ((wantCallBack || wantCallBack == undefined) && control.callback) control.callback.apply(input[0], [input.val(), $('a', control.current)[0]]);
}, readOnly: function (toggle, disable) {
var control = this.data('rating');
if (!control) return this;
control.readOnly = toggle || toggle == undefined ? true : false;
if (disable) $(control.inputs).attr("disabled", "disabled"); else $(control.inputs).removeAttr("disabled");
this.data('rating', control);
this.rating('draw');
}, disable: function () {
this.rating('readOnly', true, true);
}, enable: function () {
this.rating('readOnly', false, false);
}
});
$.fn.rating.options = {cancel: 'Cancel Rating', cancelValue: '', split: 0, starWidth: 16};
})(jQuery);
(function ($) {
$.extend({
tablesorter: new
function () {
var parsers = [], widgets = [];
this.defaults = {
cssHeader: "header",
cssAsc: "headerSortUp",
cssDesc: "headerSortDown",
cssChildRow: "expand-child",
sortInitialOrder: "asc",
sortMultiSortKey: "shiftKey",
sortForce: null,
sortAppend: null,
sortLocaleCompare: true,
textExtraction: "simple",
parsers: {},
widgets: [],
widgetZebra: {css: ["even", "odd"]},
headers: {},
widthFixed: false,
cancelSelection: true,
sortList: [],
headerList: [],
dateFormat: "us",
decimal: '/\.|\,/g',
onRenderHeader: null,
selectorHeaders: 'thead th',
debug: false
};
function benchmark(s, d) {
log(s + "," + (new Date().getTime() - d.getTime()) + "ms");
}
this.benchmark = benchmark;
function log(s) {
if (typeof console != "undefined" && typeof console.debug != "undefined") {
console.log(s);
} else {
alert(s);
}
}
function buildParserCache(table, $headers) {
if (table.config.debug) {
var parsersDebug = "";
}
if (table.tBodies.length == 0) return;
var rows = table.tBodies[0].rows;
if (rows[0]) {
var list = [], cells = rows[0].cells, l = cells.length;
for (var c = 0; c < l; c++) {
var p = false;
if ($.metadata && ($($headers[c]).metadata() && $($headers[c]).metadata().sorter)) {
p = getParserById($($headers[c]).metadata().sorter);
} else if ((table.config.headers[c] && table.config.headers[c].sorter)) {
p = getParserById(table.config.headers[c].sorter);
}
if (!p) {
p = detectParserForColumn(table, rows, -1, c);
}
if (table.config.debug) {
parsersDebug += "column:" + c + " parser:" + p.id + "\n";
}
list.push(p);
}
}
if (table.config.debug) {
log(parsersDebug);
}
return list;
};
function detectParserForColumn(table, rows, rowIndex, cellIndex) {
var l = parsers.length, node = false, nodeValue = false, keepLooking = true;
while (nodeValue == '' && keepLooking) {
rowIndex++;
if (rows[rowIndex]) {
node = getNodeFromRowAndCellIndex(rows, rowIndex, cellIndex);
nodeValue = trimAndGetNodeText(table.config, node);
if (table.config.debug) {
log('Checking if value was empty on row:' + rowIndex);
}
} else {
keepLooking = false;
}
}
for (var c = 1; c < l; c++) {
if (parsers[c].is(nodeValue, table, node)) {
return parsers[c];
}
}
return parsers[0];
}
function getNodeFromRowAndCellIndex(rows, rowIndex, cellIndex) {
return rows[rowIndex].cells[cellIndex];
}
function trimAndGetNodeText(config, node) {
return $.trim(getElementText(config, node));
}
function getParserById(name) {
var l = parsers.length;
for (var c = 0; c < l; c++) {
if (parsers[c].id.toLowerCase() == name.toLowerCase()) {
return parsers[c];
}
}
return false;
}
function buildCache(table) {
var b = table.tBodies[0], totalRows = (b && b.rows.length) || 0,
totalCells = (b.rows[0] && b.rows[0].cells.length) || 0, parsers = table.config.parsers, cache = {
row: [],
normalized: []
}, t, i, j, c, cols, cacheTime;
if (table.config.debug) {
cacheTime = new Date();
}
for (i = 0; i < totalRows; ++i) {
c = $(b.rows[i]);
cols = [];
if (c.hasClass(table.config.cssChildRow)) {
cache.row[cache.row.length - 1] = cache.row[cache.row.length - 1].add(c);
continue;
}
cache.row.push(c);
for (j = 0; j < totalCells; ++j) {
t = trimAndGetNodeText(table.config, c[0].cells[j], j);
cols.push(parsers[j].format(t, table, c[0].cells[j], j));
}
cols.push(cache.normalized.length);
cache.normalized.push(cols);
}
if (table.config.debug) {
benchmark("Building cache for " + totalRows + " rows", cacheTime);
}
table.config.cache = cache;
return cache;
}
function getElementText(config, node) {
var text = "";
if (!node) return "";
if (!config.supportsTextContent) config.supportsTextContent = node.textContent || false;
if (config.textExtraction == "simple") {
if (config.supportsTextContent) {
text = node.textContent;
} else {
if (node.childNodes[0] && node.childNodes[0].hasChildNodes()) {
text = node.childNodes[0].innerHTML;
} else {
text = node.innerHTML;
}
}
} else {
if (typeof(config.textExtraction) == "function") {
text = config.textExtraction(node);
} else {
text = $(node).text();
}
}
return text;
}
function appendToTable(table, cache) {
if (table.config.debug) {
console.log(table);
var appendTime = new Date()
}
var c = cache, r = c.row, n = c.normalized, totalRows = n.length, checkCell = (n[0].length - 1),
tableBody = $(table.tBodies[0]), rows = [];
for (var c = 0; c < totalRows; c++) {
var pos = n[c][checkCell];
rows.push(r[pos]);
if (!table.config.appender) {
var l = r[pos].length;
for (var j = 0; j < l; j++) {
tableBody[0].appendChild(r[pos][j]);
}
}
}
if (table.config.appender) {
table.config.appender(table, rows);
}
rows = null;
if (table.config.debug) {
benchmark("Rebuilt table:", appendTime);
}
applyWidget(table);
setTimeout(function () {
$(table).trigger("sortEnd");
}, 0);
}
function buildHeaders(table) {
if (table.config.debug) {
var time = new Date();
}
var meta = ($.metadata) ? true : false;
var header_index = computeTableHeaderCellIndexes(table);
$tableHeaders = $(table.config.selectorHeaders, table).each(function (index) {
this.column = header_index[this.parentNode.rowIndex + "-" + this.cellIndex];
this.order = formatSortingOrder(table.config.sortInitialOrder);
this.count = this.order;
if (checkHeaderMetadata(this) || checkHeaderOptions(table, index)) this.sortDisabled = true;
if (checkHeaderOptionsSortingLocked(table, index)) this.order = this.lockedOrder = checkHeaderOptionsSortingLocked(table, index);
if (!this.sortDisabled) {
var $th = $(this).addClass(table.config.cssHeader);
if (table.config.onRenderHeader) table.config.onRenderHeader.apply($th);
}
table.config.headerList[index] = this;
});
if (table.config.debug) {
benchmark("Built headers:", time);
log($tableHeaders);
}
return $tableHeaders;
}
function computeTableHeaderCellIndexes(t) {
var matrix = [];
var lookup = {};
var thead = t.getElementsByTagName('THEAD')[0];
var trs = thead.getElementsByTagName('TR');
for (var c = 0; c < trs.length; c++) {
var cells = trs[c].cells;
for (var j = 0; j < cells.length; j++) {
var c = cells[j];
var rowIndex = c.parentNode.rowIndex;
var cellId = rowIndex + "-" + c.cellIndex;
var rowSpan = c.rowSpan || 1;
var colSpan = c.colSpan || 1
var firstAvailCol;
if (typeof(matrix[rowIndex]) == "undefined") {
matrix[rowIndex] = [];
}
for (var k = 0; k < matrix[rowIndex].length + 1; k++) {
if (typeof(matrix[rowIndex][k]) == "undefined") {
firstAvailCol = k;
break;
}
}
lookup[cellId] = firstAvailCol;
for (var k = rowIndex; k < rowIndex + rowSpan; k++) {
if (typeof(matrix[k]) == "undefined") {
matrix[k] = [];
}
var matrixrow = matrix[k];
for (var l = firstAvailCol; l < firstAvailCol + colSpan; l++) {
matrixrow[l] = "x";
}
}
}
}
return lookup;
}
function checkCellColSpan(table, rows, row) {
var arr = [], r = table.tHead.rows, c = r[row].cells;
for (var c = 0; c < c.length; c++) {
var cell = c[c];
if (cell.colSpan > 1) {
arr = arr.concat(checkCellColSpan(table, headerArr, row++));
} else {
if (table.tHead.length == 1 || (cell.rowSpan > 1 || !r[row + 1])) {
arr.push(cell);
}
}
}
return arr;
}
function checkHeaderMetadata(cell) {
if (($.metadata) && ($(cell).metadata().sorter === false)) {
return true;
}
;
return false;
}
function checkHeaderOptions(table, c) {
if ((table.config.headers[c]) && (table.config.headers[c].sorter === false)) {
return true;
}
;
return false;
}
function checkHeaderOptionsSortingLocked(table, c) {
if ((table.config.headers[c]) && (table.config.headers[c].lockedOrder)) return table.config.headers[c].lockedOrder;
return false;
}
function applyWidget(table) {
var c = table.config.widgets;
var l = c.length;
for (var c = 0; c < l; c++) {
getWidgetById(c[c]).format(table);
}
}
function getWidgetById(name) {
var l = widgets.length;
for (var c = 0; c < l; c++) {
if (widgets[c].id.toLowerCase() == name.toLowerCase()) {
return widgets[c];
}
}
};
function formatSortingOrder(v) {
if (typeof(v) != "Number") {
return (v.toLowerCase() == "desc") ? 1 : 0;
} else {
return (v == 1) ? 1 : 0;
}
}
function isValueInArray(v, a) {
var l = a.length;
for (var c = 0; c < l; c++) {
if (a[c][0] == v) {
return true;
}
}
return false;
}
function setHeadersCss(table, $headers, list, css) {
$headers.removeClass(css[0]).removeClass(css[1]);
var h = [];
$headers.each(function (offset) {
if (!this.sortDisabled) {
h[this.column] = $(this);
}
});
var l = list.length;
for (var c = 0; c < l; c++) {
h[list[c][0]].addClass(css[list[c][1]]);
}
}
function fixColumnWidth(table, $headers) {
var c = table.config;
if (c.widthFixed) {
var colgroup = $('');
$("tr:first td", table.tBodies[0]).each(function () {
colgroup.append($(' ').css('width', $(this).width()));
});
$(table).prepend(colgroup);
}
;
}
function updateHeaderSortCount(table, sortList) {
var conf = table.config, l = sortList.length;
for (var c = 0; c < l; c++) {
var s = sortList[c], o = conf.headerList[s[0]];
o.count = s[1];
o.count++;
}
}
function multisort(table, sortList, cache) {
if (table.config.debug) {
var sortTime = new Date();
}
var dynamicExp = "var sortWrapper = function(a,b) {", l = sortList.length;
for (var i = 0; i < l; i++) {
try {
var c = sortList[i][0];
var order = sortList[i][1];
} catch (err) {
var c = 0;
var order = 1;
}
var s = (table.config.parsers[c].type == "text") ? ((order == 0) ? makeSortFunction("text", "asc", c) : makeSortFunction("text", "desc", c)) : ((order == 0) ? makeSortFunction("numeric", "asc", c) : makeSortFunction("numeric", "desc", c));
var e = "e" + c;
dynamicExp += "var " + e + " = " + s;
dynamicExp += "if(" + e + ") { return " + e + "; } ";
dynamicExp += "else { ";
}
var orgOrderCol = cache.normalized[0].length - 1;
dynamicExp += "return a[" + orgOrderCol + "]-b[" + orgOrderCol + "];";
for (var c = 0; c < l; c++) {
dynamicExp += "}; ";
}
dynamicExp += "return 0; ";
dynamicExp += "}; ";
if (table.config.debug) {
benchmark("Evaling expression:" + dynamicExp, new Date());
}
eval(dynamicExp);
cache.normalized.sort(sortWrapper);
if (table.config.debug) {
benchmark("Sorting on " + sortList.toString() + " and dir " + order + " time:", sortTime);
}
return cache;
};
function makeSortFunction(type, direction, index) {
var a = "a[" + index + "]", b = "b[" + index + "]";
if (type == 'text' && direction == 'asc') {
return "(" + a + " == " + b + " ? 0 : (" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : (" + a + " < " + b + ") ? -1 : 1 )));";
} else if (type == 'text' && direction == 'desc') {
return "(" + a + " == " + b + " ? 0 : (" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : (" + b + " < " + a + ") ? -1 : 1 )));";
} else if (type == 'numeric' && direction == 'asc') {
return "(" + a + " === null && " + b + " === null) ? 0 :(" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : " + a + " - " + b + "));";
} else if (type == 'numeric' && direction == 'desc') {
return "(" + a + " === null && " + b + " === null) ? 0 :(" + a + " === null ? Number.POSITIVE_INFINITY : (" + b + " === null ? Number.NEGATIVE_INFINITY : " + b + " - " + a + "));";
}
};
function makeSortText(c) {
return "((a[" + c + "] < b[" + c + "]) ? -1 : ((a[" + c + "] > b[" + c + "]) ? 1 : 0));";
};
function makeSortTextDesc(c) {
return "((b[" + c + "] < a[" + c + "]) ? -1 : ((b[" + c + "] > a[" + c + "]) ? 1 : 0));";
};
function makeSortNumeric(c) {
return "a[" + c + "]-b[" + c + "];";
};
function makeSortNumericDesc(c) {
return "b[" + c + "]-a[" + c + "];";
};
function sortText(a, b) {
if (table.config.sortLocaleCompare) return a.localeCompare(b);
return ((a < b) ? -1 : ((a > b) ? 1 : 0));
};
function sortTextDesc(a, b) {
if (table.config.sortLocaleCompare) return b.localeCompare(a);
return ((b < a) ? -1 : ((b > a) ? 1 : 0));
};
function sortNumeric(a, b) {
return a - b;
};
function sortNumericDesc(a, b) {
return b - a;
};
function getCachedSortType(parsers, c) {
return parsers[c].type;
};
this.construct = function (settings) {
return this.each(function () {
if (!this.tHead || !this.tBodies) return;
var $this, $document, $headers, cache, config, shiftDown = 0, sortOrder;
this.config = {};
config = $.extend(this.config, $.tablesorter.defaults, settings);
$this = $(this);
$.data(this, "tablesorter", config);
$headers = buildHeaders(this);
this.config.parsers = buildParserCache(this, $headers);
cache = buildCache(this);
var sortCSS = [config.cssDesc, config.cssAsc];
fixColumnWidth(this);
$headers.click(function (e) {
var totalRows = ($this[0].tBodies[0] && $this[0].tBodies[0].rows.length) || 0;
if (!this.sortDisabled && totalRows > 0) {
$this.trigger("sortStart");
var $cell = $(this);
var c = this.column;
this.order = this.count++ % 2;
if (this.lockedOrder) this.order = this.lockedOrder;
if (!e[config.sortMultiSortKey]) {
config.sortList = [];
if (config.sortForce != null) {
var a = config.sortForce;
for (var j = 0; j < a.length; j++) {
if (a[j][0] != c) {
config.sortList.push(a[j]);
}
}
}
config.sortList.push([c, this.order]);
} else {
if (isValueInArray(c, config.sortList)) {
for (var j = 0; j < config.sortList.length; j++) {
var s = config.sortList[j], o = config.headerList[s[0]];
if (s[0] == c) {
o.count = s[1];
o.count++;
s[1] = o.count % 2;
}
}
} else {
config.sortList.push([c, this.order]);
}
}
;
setTimeout(function () {
setHeadersCss($this[0], $headers, config.sortList, sortCSS);
appendToTable($this[0], multisort($this[0], config.sortList, cache));
}, 1);
return false;
}
}).mousedown(function () {
if (config.cancelSelection) {
this.onselectstart = function () {
return false
};
return false;
}
});
$this.bind("update", function () {
var me = this;
setTimeout(function () {
me.config.parsers = buildParserCache(me, $headers);
cache = buildCache(me);
}, 1);
}).bind("updateCell", function (e, cell) {
var config = this.config;
var pos = [(cell.parentNode.rowIndex - 1), cell.cellIndex];
cache.normalized[pos[0]][pos[1]] = config.parsers[pos[1]].format(getElementText(config, cell), cell);
}).bind("sorton", function (e, list) {
$(this).trigger("sortStart");
config.sortList = list;
var sortList = config.sortList;
updateHeaderSortCount(this, sortList);
setHeadersCss(this, $headers, sortList, sortCSS);
appendToTable(this, multisort(this, sortList, cache));
}).bind("appendCache", function () {
appendToTable(this, cache);
}).bind("applyWidgetId", function (e, id) {
getWidgetById(id).format(this);
}).bind("applyWidgets", function () {
applyWidget(this);
});
if ($.metadata && ($(this).metadata() && $(this).metadata().sortlist)) {
config.sortList = $(this).metadata().sortlist;
}
if (config.sortList.length > 0) {
$this.trigger("sorton", [config.sortList]);
}
applyWidget(this);
});
};
this.addParser = function (parser) {
var l = parsers.length, a = true;
for (var c = 0; c < l; c++) {
if (parsers[c].id.toLowerCase() == parser.id.toLowerCase()) {
a = false;
}
}
if (a) {
parsers.push(parser);
}
;
};
this.addWidget = function (widget) {
widgets.push(widget);
};
this.formatFloat = function (s) {
var c = parseFloat(s);
return (isNaN(c)) ? 0 : c;
};
this.formatInt = function (s) {
var c = parseInt(s);
return (isNaN(c)) ? 0 : c;
};
this.isDigit = function (s, config) {
return /^[-+]?\d*$/.test($.trim(s.replace(/[,.']/g, '')));
};
this.clearTableBody = function (table) {
if ($.browser.msie) {
function empty() {
while (this.firstChild) this.removeChild(this.firstChild);
}
empty.apply(table.tBodies[0]);
} else {
table.tBodies[0].innerHTML = "";
}
};
}
});
$.fn.extend({tablesorter: $.tablesorter.construct});
var ts = $.tablesorter;
ts.addParser({
id: "text", is: function (s) {
return true;
}, format: function (s) {
return $.trim(s.toLocaleLowerCase());
}, type: "text"
});
ts.addParser({
id: "digit", is: function (s, table) {
var c = table.config;
return $.tablesorter.isDigit(s, c);
}, format: function (s) {
return $.tablesorter.formatFloat(s);
}, type: "numeric"
});
ts.addParser({
id: "currency", is: function (s) {
return /^[£$€?.]/.test(s);
}, format: function (s) {
return $.tablesorter.formatFloat(s.replace(new RegExp(/[£$€]/g), ""));
}, type: "numeric"
});
ts.addParser({
id: "ipAddress", is: function (s) {
return /^\d{2,3}[\.]\d{2,3}[\.]\d{2,3}[\.]\d{2,3}$/.test(s);
}, format: function (s) {
var a = s.split("."), r = "", l = a.length;
for (var c = 0; c < l; c++) {
var item = a[c];
if (item.length == 2) {
r += "0" + item;
} else {
r += item;
}
}
return $.tablesorter.formatFloat(r);
}, type: "numeric"
});
ts.addParser({
id: "url", is: function (s) {
return /^(https?|ftp|file):\/\/$/.test(s);
}, format: function (s) {
return jQuery.trim(s.replace(new RegExp(/(https?|ftp|file):\/\//), ''));
}, type: "text"
});
ts.addParser({
id: "isoDate", is: function (s) {
return /^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(s);
}, format: function (s) {
return $.tablesorter.formatFloat((s != "") ? new Date(s.replace(new RegExp(/-/g), "/")).getTime() : "0");
}, type: "numeric"
});
ts.addParser({
id: "percent", is: function (s) {
return /\%$/.test($.trim(s));
}, format: function (s) {
return $.tablesorter.formatFloat(s.replace(new RegExp(/%/g), ""));
}, type: "numeric"
});
ts.addParser({
id: "usLongDate", is: function (s) {
return s.match(new RegExp(/^[A-Za-z]{3,10}\.? [0-9]{1,2}, ([0-9]{4}|'?[0-9]{2}) (([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(AM|PM)))$/));
}, format: function (s) {
return $.tablesorter.formatFloat(new Date(s).getTime());
}, type: "numeric"
});
ts.addParser({
id: "shortDate", is: function (s) {
return /\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}/.test(s);
}, format: function (s, table) {
var c = table.config;
s = s.replace(/\-/g, "/");
if (c.dateFormat == "us") {
s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/, "$3/$1/$2");
} else if (c.dateFormat == "uk") {
s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/, "$3/$2/$1");
} else if (c.dateFormat == "dd/mm/yy" || c.dateFormat == "dd-mm-yy") {
s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/, "$1/$2/$3");
}
return $.tablesorter.formatFloat(new Date(s).getTime());
}, type: "numeric"
});
ts.addParser({
id: "time", is: function (s) {
return /^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(am|pm)))$/.test(s);
}, format: function (s) {
return $.tablesorter.formatFloat(new Date("2000/01/01 " + s).getTime());
}, type: "numeric"
});
ts.addParser({
id: "metadata", is: function (s) {
return false;
}, format: function (s, table, cell) {
var c = table.config, p = (!c.parserMetadataName) ? 'sortValue' : c.parserMetadataName;
return $(cell).metadata()[p];
}, type: "numeric"
});
ts.addWidget({
id: "zebra", format: function (table) {
if (table.config.debug) {
var time = new Date();
}
var $tr, row = -1, odd;
$("tr:visible", table.tBodies[0]).each(function (c) {
$tr = $(this);
if (!$tr.hasClass(table.config.cssChildRow)) row++;
odd = (row % 2 == 0);
$tr.removeClass(table.config.widgetZebra.css[odd ? 0 : 1]).addClass(table.config.widgetZebra.css[odd ? 1 : 0])
});
if (table.config.debug) {
$.tablesorter.benchmark("Applying Zebra widget", time);
}
}
});
})(jQuery);
$(document).ready(function () {
$("#graphic-targets").click(function () {
var img_path = $("#image-path").val();
var img_name = img_path + "Ziele.png";
$("#axis-graphic").attr('src', img_name);
});
$("#graphic-power").click(function () {
var img_path = $("#image-path").val();
var img_name = img_path + "1.png";
$("#axis-graphic").attr('src', img_name);
});
$("#graphic-motivation-start").click(function () {
var img_path = $("#image-path").val();
var img_name = img_path + "Motivation-Start.png";
$("#axis-graphic").attr('src', img_name);
});
$("#graphic-success").click(function () {
var img_path = $("#image-path").val();
var img_name = img_path + "Erfolg.png";
$("#axis-graphic").attr('src', img_name);
});
$("#graphic-no-coaching").click(function () {
var img_path = $("#image-path").val();
var img_name = img_path + "Motivation-ohne.png";
$("#axis-graphic").attr('src', img_name);
});
$("#graphic-with-coaching").click(function () {
var img_path = $("#image-path").val();
var img_name = img_path + "Motivation-mit.png";
$("#axis-graphic").attr('src', img_name);
});
$("#graphic-start").click(function () {
var img_path = $("#image-path").val();
var img_name = img_path + "Start.png";
$("#axis-graphic").attr('src', img_name);
});
});
function NumberFormat(num, inputDecimal) {
this.VERSION = 'Number Format v1.5.4';
this.COMMA = ',';
this.PERIOD = '.';
this.DASH = '-';
this.LEFT_PAREN = '(';
this.RIGHT_PAREN = ')';
this.LEFT_OUTSIDE = 0;
this.LEFT_INSIDE = 1;
this.RIGHT_INSIDE = 2;
this.RIGHT_OUTSIDE = 3;
this.LEFT_DASH = 0;
this.RIGHT_DASH = 1;
this.PARENTHESIS = 2;
this.NO_ROUNDING = -1
this.num;
this.numOriginal;
this.hasSeparators = false;
this.separatorValue;
this.inputDecimalValue;
this.decimalValue;
this.negativeFormat;
this.negativeRed;
this.hasCurrency;
this.currencyPosition;
this.currencyValue;
this.places;
this.roundToPlaces;
this.truncate;
this.setNumber = setNumberNF;
this.toUnformatted = toUnformattedNF;
this.setInputDecimal = setInputDecimalNF;
this.setSeparators = setSeparatorsNF;
this.setCommas = setCommasNF;
this.setNegativeFormat = setNegativeFormatNF;
this.setNegativeRed = setNegativeRedNF;
this.setCurrency = setCurrencyNF;
this.setCurrencyPrefix = setCurrencyPrefixNF;
this.setCurrencyValue = setCurrencyValueNF;
this.setCurrencyPosition = setCurrencyPositionNF;
this.setPlaces = setPlacesNF;
this.toFormatted = toFormattedNF;
this.toPercentage = toPercentageNF;
this.getOriginal = getOriginalNF;
this.moveDecimalRight = moveDecimalRightNF;
this.moveDecimalLeft = moveDecimalLeftNF;
this.getRounded = getRoundedNF;
this.preserveZeros = preserveZerosNF;
this.justNumber = justNumberNF;
this.expandExponential = expandExponentialNF;
this.getZeros = getZerosNF;
this.moveDecimalAsString = moveDecimalAsStringNF;
this.moveDecimal = moveDecimalNF;
this.addSeparators = addSeparatorsNF;
if (inputDecimal == null) {
this.setNumber(num, this.PERIOD);
} else {
this.setNumber(num, inputDecimal);
}
this.setCommas(true);
this.setNegativeFormat(this.LEFT_DASH);
this.setNegativeRed(false);
this.setCurrency(false);
this.setCurrencyPrefix('$');
this.setPlaces(2);
}
function setInputDecimalNF(val) {
this.inputDecimalValue = val;
}
function setNumberNF(num, inputDecimal) {
if (inputDecimal != null) {
this.setInputDecimal(inputDecimal);
}
this.numOriginal = num;
this.num = this.justNumber(num);
}
function toUnformattedNF() {
return (this.num);
}
function getOriginalNF() {
return (this.numOriginal);
}
function setNegativeFormatNF(format) {
this.negativeFormat = format;
}
function setNegativeRedNF(isRed) {
this.negativeRed = isRed;
}
function setSeparatorsNF(isC, separator, decimal) {
this.hasSeparators = isC;
if (separator == null)
separator = this.COMMA;
if (decimal == null)
decimal = this.PERIOD;
if (separator == decimal) {
this.decimalValue = (decimal == this.PERIOD) ? this.COMMA : this.PERIOD;
} else {
this.decimalValue = decimal;
}
this.separatorValue = separator;
}
function setCommasNF(isC) {
this.setSeparators(isC, this.COMMA, this.PERIOD);
}
function setCurrencyNF(isC) {
this.hasCurrency = isC;
}
function setCurrencyValueNF(val) {
this.currencyValue = val;
}
function setCurrencyPrefixNF(cp) {
this.setCurrencyValue(cp);
this.setCurrencyPosition(this.LEFT_OUTSIDE);
}
function setCurrencyPositionNF(cp) {
this.currencyPosition = cp
}
function setPlacesNF(p, tr) {
this.roundToPlaces = !(p == this.NO_ROUNDING);
this.truncate = (tr != null && tr);
this.places = (p < 0) ? 0 : p;
}
function addSeparatorsNF(nStr, inD, outD, sep) {
nStr += '';
var dpos = nStr.indexOf(inD);
var nStrEnd = '';
if (dpos != -1) {
nStrEnd = outD + nStr.substring(dpos + 1, nStr.length);
nStr = nStr.substring(0, dpos);
}
var rgx = /(\d+)(\d{3})/;
while (rgx.test(nStr)) {
nStr = nStr.replace(rgx, '$1' + sep + '$2');
}
return nStr + nStrEnd;
}
function toFormattedNF() {
var pos;
var nNum = this.num;
var nStr;
var splitString = new Array(2);
if (this.roundToPlaces) {
nNum = this.getRounded(nNum);
nStr = this.preserveZeros(Math.abs(nNum));
} else {
nStr = this.expandExponential(Math.abs(nNum));
}
if (this.hasSeparators) {
nStr = this.addSeparators(nStr, this.PERIOD, this.decimalValue, this.separatorValue);
} else {
nStr = nStr.replace(new RegExp('\\' + this.PERIOD), this.decimalValue);
}
var c0 = '';
var n0 = '';
var c1 = '';
var n1 = '';
var n2 = '';
var c2 = '';
var n3 = '';
var c3 = '';
var negSignL = (this.negativeFormat == this.PARENTHESIS) ? this.LEFT_PAREN : this.DASH;
var negSignR = (this.negativeFormat == this.PARENTHESIS) ? this.RIGHT_PAREN : this.DASH;
if (this.currencyPosition == this.LEFT_OUTSIDE) {
if (nNum < 0) {
if (this.negativeFormat == this.LEFT_DASH || this.negativeFormat == this.PARENTHESIS)
n1 = negSignL;
if (this.negativeFormat == this.RIGHT_DASH || this.negativeFormat == this.PARENTHESIS)
n2 = negSignR;
}
if (this.hasCurrency)
c0 = this.currencyValue;
} else if (this.currencyPosition == this.LEFT_INSIDE) {
if (nNum < 0) {
if (this.negativeFormat == this.LEFT_DASH || this.negativeFormat == this.PARENTHESIS)
n0 = negSignL;
if (this.negativeFormat == this.RIGHT_DASH || this.negativeFormat == this.PARENTHESIS)
n3 = negSignR;
}
if (this.hasCurrency)
c1 = this.currencyValue;
} else if (this.currencyPosition == this.RIGHT_INSIDE) {
if (nNum < 0) {
if (this.negativeFormat == this.LEFT_DASH || this.negativeFormat == this.PARENTHESIS)
n0 = negSignL;
if (this.negativeFormat == this.RIGHT_DASH || this.negativeFormat == this.PARENTHESIS)
n3 = negSignR;
}
if (this.hasCurrency)
c2 = this.currencyValue;
} else if (this.currencyPosition == this.RIGHT_OUTSIDE) {
if (nNum < 0) {
if (this.negativeFormat == this.LEFT_DASH || this.negativeFormat == this.PARENTHESIS)
n1 = negSignL;
if (this.negativeFormat == this.RIGHT_DASH || this.negativeFormat == this.PARENTHESIS)
n2 = negSignR;
}
if (this.hasCurrency)
c3 = this.currencyValue;
}
nStr = c0 + n0 + c1 + n1 + nStr + n2 + c2 + n3 + c3;
if (this.negativeRed && nNum < 0) {
nStr = '' + nStr + ' ';
}
return (nStr);
}
function toPercentageNF() {
nNum = this.num * 100;
nNum = this.getRounded(nNum);
return nNum + '%';
}
function getZerosNF(places) {
var extraZ = '';
var c;
for (c = 0; c < places; c++) {
extraZ += '0';
}
return extraZ;
}
function expandExponentialNF(origVal) {
if (isNaN(origVal))
return origVal;
var newVal = parseFloat(origVal) + '';
var eLoc = newVal.toLowerCase().indexOf('e');
if (eLoc != -1) {
var plusLoc = newVal.toLowerCase().indexOf('+');
var negLoc = newVal.toLowerCase().indexOf('-', eLoc);
var justNumber = newVal.substring(0, eLoc);
if (negLoc != -1) {
var places = newVal.substring(negLoc + 1, newVal.length);
justNumber = this.moveDecimalAsString(justNumber, true, parseInt(places));
} else {
if (plusLoc == -1)
plusLoc = eLoc;
var places = newVal.substring(plusLoc + 1, newVal.length);
justNumber = this.moveDecimalAsString(justNumber, false, parseInt(places));
}
newVal = justNumber;
}
return newVal;
}
function moveDecimalRightNF(val, places) {
var newVal = '';
if (places == null) {
newVal = this.moveDecimal(val, false);
} else {
newVal = this.moveDecimal(val, false, places);
}
return newVal;
}
function moveDecimalLeftNF(val, places) {
var newVal = '';
if (places == null) {
newVal = this.moveDecimal(val, true);
} else {
newVal = this.moveDecimal(val, true, places);
}
return newVal;
}
function moveDecimalAsStringNF(val, left, places) {
var spaces = (arguments.length < 3) ? this.places : places;
if (spaces <= 0)
return val;
var newVal = val + '';
var extraZ = this.getZeros(spaces);
var re1 = new RegExp('([0-9.]+)');
if (left) {
newVal = newVal.replace(re1, extraZ + '$1');
var re2 = new RegExp('(-?)([0-9]*)([0-9]{' + spaces + '})(\\.?)');
newVal = newVal.replace(re2, '$1$2.$3');
} else {
var reArray = re1.exec(newVal);
if (reArray != null) {
newVal = newVal.substring(0, reArray.index) + reArray[1] + extraZ
+ newVal.substring(reArray.index + reArray[0].length);
}
var re2 = new RegExp('(-?)([0-9]*)(\\.?)([0-9]{' + spaces + '})');
newVal = newVal.replace(re2, '$1$2$4.');
}
newVal = newVal.replace(/\.$/, '');
return newVal;
}
function moveDecimalNF(val, left, places) {
var newVal = '';
if (places == null) {
newVal = this.moveDecimalAsString(val, left);
} else {
newVal = this.moveDecimalAsString(val, left, places);
}
return parseFloat(newVal);
}
function getRoundedNF(val) {
val = this.moveDecimalRight(val);
if (this.truncate) {
val = val >= 0 ? Math.floor(val) : Math.ceil(val);
} else {
val = Math.round(val);
}
val = this.moveDecimalLeft(val);
return val;
}
function preserveZerosNF(val) {
var c;
val = this.expandExponential(val);
if (this.places <= 0)
return val;
var decimalPos = val.indexOf('.');
if (decimalPos == -1) {
val += '.';
for (c = 0; c < this.places; c++) {
val += '0';
}
} else {
var actualDecimals = (val.length - 1) - decimalPos;
var difference = this.places - actualDecimals;
for (c = 0; c < difference; c++) {
val += '0';
}
}
return val;
}
function justNumberNF(val) {
newVal = val + '';
var isPercentage = false;
if (newVal.indexOf('%') != -1) {
newVal = newVal.replace(/\%/g, '');
isPercentage = true;
}
var re = new RegExp('[^\\' + this.inputDecimalValue + '\\d\\-\\+\\(\\)eE]', 'g');
newVal = newVal.replace(re, '');
var tempRe = new RegExp('[' + this.inputDecimalValue + ']', 'g');
var treArray = tempRe.exec(newVal);
if (treArray != null) {
var tempRight = newVal.substring(treArray.index + treArray[0].length);
newVal = newVal.substring(0, treArray.index) + this.PERIOD
+ tempRight.replace(tempRe, '');
}
if (newVal.charAt(newVal.length - 1) == this.DASH) {
newVal = newVal.substring(0, newVal.length - 1);
newVal = '-' + newVal;
} else if (newVal.charAt(0) == this.LEFT_PAREN && newVal.charAt(newVal.length - 1) == this.RIGHT_PAREN) {
newVal = newVal.substring(1, newVal.length - 1);
newVal = '-' + newVal;
}
newVal = parseFloat(newVal);
if (!isFinite(newVal)) {
newVal = 0;
}
if (isPercentage) {
newVal = this.moveDecimalLeft(newVal, 2);
}
return newVal;
}
$(document).ready(function () {
$("#add-test-level").click(function () {
var url = getUrl();
if (url.indexOf("?") > -1) {
url = url.substr(0, url.indexOf("?"));
}
var is_method = url.substring(url.lastIndexOf('/'));
if (is_method.substr(-3, 3) == ".do")
url = url.substr(0, url.length - is_method.length);
var count = $("#ajax-test-level-result tr").length;
$.post(url + "/addTestlevel.do", {count: count}, function (data) {
$("#ajax-test-level-result").append(data);
});
});
});
function removeTestlevel(item) {
$(item).parent().parent().remove();
}
function formatNumber(value, currency) {
var num = new NumberFormat();
num.setInputDecimal('.');
num.setNumber(value);
num.setPlaces('2', false);
num.setCurrency(true);
num.setCurrencyValue(currency);
num.setCurrencyPosition(num.RIGHT_OUTSIDE);
num.setNegativeFormat(num.LEFT_DASH);
num.setNegativeRed(false);
num.setSeparators(true, '.', ',');
return num.toFormatted();
}
$(document).ready(function () {
$(".reduction").change(function () {
var reduction = $(this).val();
reduction = 100 - parseInt(reduction);
var orig_price = $(this).prev().prev().val();
orig_price = orig_price.replace(/\./g, "");
orig_price = orig_price.replace(",", ".");
orig_price = parseFloat(orig_price).toFixed(2);
var new_price = (orig_price * reduction) / 100;
new_price = formatNumber(new_price, " €");
$(this).prev().html(new_price);
calcSums();
});
});
function calcSums() {
var recommended_price = getEmptyArray();
$(".recommended-price").each(function (k, v) {
if ($(v).parent().parent().parent().prev().prev().val() == 1) {
var price = $(v).html().replace(" €", "");
var interval = $(v).prev().prev().val();
price = price.replace(/\./g, "");
price = price.replace(",", ".");
price = parseFloat(price);
if (!isNaN(price))
recommended_price[interval] += price;
}
});
$("#recommended-sum").empty();
for (c in recommended_price) {
if (recommended_price[c] > 0.0) {
$("#recommended-sum").append(' ' + '' + c + ' ' + '' + formatNumber(recommended_price[c], " €") + ' ' + ' ');
}
}
var remaining_price = getEmptyArray();
$(".remaining-price").each(function (k, v) {
if ($(v).parent().parent().parent().prev().prev().val() == 1) {
var price = $(v).html().replace(" €", "");
var interval = $(v).prev().prev().val();
price = price.replace(/\./g, "");
price = price.replace(",", ".");
price = parseFloat(price);
if (!isNaN(price))
remaining_price[interval] += price;
}
});
$("#remaining-sum").empty();
for (c in remaining_price) {
if (remaining_price[c] > 0.0) {
$("#remaining-sum").append('' + '' + c + ' ' + '' + formatNumber(remaining_price[c], " €") + ' ' + ' ');
}
}
var lump_price = getEmptyArray();
$(".lump-price").each(function (k, v) {
if ($(v).parent().parent().parent().prev().prev().val() == 1) {
var price = $(v).html().replace(" €", "");
var interval = $(v).prev().prev().val();
price = price.replace(/\./g, "");
price = price.replace(",", ".");
price = parseFloat(price);
if (!isNaN(price))
lump_price[interval] += price;
}
});
$("#lump-sum").empty();
for (c in lump_price) {
if (lump_price[c] > 0.0) {
$("#lump-sum").append('' + '' + c + ' ' + '' + formatNumber(lump_price[c], " €") + ' ' + ' ');
}
}
}
$(document).ready(function () {
$(".eval-choose").on("click", function () {
evalchoose($(this));
});
$(".document-remove").click(function () {
removeDocument(this);
});
function removeDocument(item) {
var check = confirm("Entfernen?");
if (check) {
$("#ajax-loading").dialog("open");
var parent = $(item).parent().parent();
var id = $(item).attr("data-id");
var url = getUrl();
var is_method = url.substring(url.lastIndexOf('/') + 1);
if (is_method.substr(-3, 3) == ".do")
url = url.substr(0, url.length - is_method.length);
$.post(url + "/removeDocument.do", {
id: id
}, function () {
$("#ajax-loading").dialog("close");
$(parent).remove();
});
}
}
function adjustHeight(el) {
el.style.height = (el.scrollHeight > el.clientHeight) ? (el.scrollHeight) + "px" : "60px";
}
function evalchoose(button) {
var user = button.data("user");
var eval = button.data("eval");
$("#evaluationoption-" + user).val(eval);
toogleSelected(button, user, eval);
}
function toogleSelected(button, user, eval) {
$(".eval-choose-selected-" + user).each(function () {
console.log($(this));
$(this).addClass("hidden");
});
$(button).find(".eval-choose-selected-" + user).removeClass("hidden");
}
[].forEach.call(document.querySelectorAll('img[data-src]'), function (img) {
testImage(img);
});
function testImage(img) {
var tester = new Image();
tester.onload = function () {
imageFound(img);
};
tester.onerror = function () {
imageNotFound(img);
};
tester.src = img.getAttribute('data-src');
}
function imageFound(img) {
img.src = img.getAttribute('data-src');
img.removeAttribute('data-src');
}
function imageNotFound(img) {
}
$(".inactive-player-list .teammate").click(function () {
var status = $(this).parent().find("input.stuff-selected");
if ($(status).val() == 1) {
var id = $(this).find("input").attr("data-player");
$(status).val(0);
$(this).animate({opacity: 1}, 250);
$("#active-player-list").find("input[data-player='" + id + "']").remove();
} else {
$(status).val(1);
$(this).animate({opacity: 0.5}, 250);
var newItem = $(this).parent().clone().attr("data-player", $(this).find("input").attr("data-player"));
newItem.find(".teammate").bind("click", function () {
disablePlayer($(this).parent());
});
$(newItem).find(".stuff-selected").attr("form", "teamform");
$(newItem).find(".evaluation-selected").attr("form", "teamform");
newItem.appendTo("#active-player-list .content-col");
$(".eval-choose").unbind().bind("click", function () {
evalchoose($(this));
});
newItem.find(".status-footer-small").toggleClass("hidden");
newItem.find(".next-season-label").toggleClass("hidden");
}
});
function disablePlayer(item) {
var id = $(item).find("input.stuff-selected").attr("data-player");
var origin = $(".inactive-player-list").find("input.stuff-selected[data-player='" + id + "']");
$(origin).val(0);
$(origin).parent().animate({opacity: 1}, 250);
$(origin).parent().find(".teammate").animate({opacity: 1}, 250);
$(item).remove();
}
$("#active-player-list .teammate").click(function () {
disablePlayer($(this).parent());
});
function disablePlayer(item) {
var id = $(item).find("input.stuff-selected").attr("data-player");
var origin = $(".inactive-player-list").find("input.stuff-selected[data-player='" + id + "']");
$(origin).val(0);
$(origin).parent().animate({opacity: 1}, 250);
$(origin).parent().find(".teammate").animate({opacity: 1}, 250);
$(item).remove();
}
});
var Picup2 = {
customURLScheme: 'fileupload2://',
windowname: 'fileupload',
activeFileInput: null,
currentHash: '',
hashObserverId: null,
appStoreURL: "itms-apps://itunes.com/apps/Picup",
downloadPrompt: "This form requires the Picup app. Would you like to install it now?",
shouldConvertCallbackURLScheme: true,
version: "2.1.1",
confirmAppLaunched: function () {
var clickedAt = +new Date;
setTimeout(function () {
if (+new Date - clickedAt < 2000) {
clearInterval(Picup2.hashObserverId);
Picup2.appNotInstalledHandler();
}
}, 500);
},
appNotInstalledHandler: function () {
isMobileSafari = MobileBrowserName() == 'Safari';
if (isMobileSafari && confirm(Picup2.downloadPrompt)) {
window.location.href = Picup2.appStoreURL;
}
},
callbackHandler: null,
openFileWithId: function (picID) {
window.location.href = Picup2.urlForOptions('view', {'picID': picID});
return false;
},
convertFileInput: function (inputOrInputId, options) {
var input = inputOrInputId;
if (typeof(inputOrInputId) == 'string') {
input = document.getElementById(inputOrInputId);
}
if (window.navigator.standalone) {
var inputId = input.id;
if (!inputId) {
inputId = "picupInput_" + Math.random().toString();
input.id = inputId;
}
var linkClass = "picup_input_link";
var inputLinks = document.getElementsByClassName(linkClass);
for (var c = 0; c < inputLinks.length; c++) {
var linkEl = inputLinks[c];
if (linkEl.rel == inputId) {
linkEl.parentNode.removeChild(linkEl);
}
}
var inputLink = document.createElement('a');
inputLink.className = linkClass;
inputLink.rel = inputId;
inputLink.innerHTML = "Choose File...";
inputLink.href = Picup2.urlForOptions('new', options);
input.parentNode.insertBefore(inputLink, input);
input.style.visibility = "hidden";
} else {
input.type = 'button';
input.value = "Choose File...";
input.picupOptions = options;
input.onclick = function () {
Picup2.activeFileInput = this;
if (Picup2.callbackHandler) {
Picup2.currentHash = window.location.hash;
Picup2.hashObserverId = setInterval('Picup2.checkHash()', 500);
}
window.location.href = Picup2.urlForOptions('new', this.picupOptions);
Picup2.confirmAppLaunched();
};
input.disabled = false;
}
return false;
},
checkHash: function () {
if (window.location.hash != Picup2.currentHash) {
clearInterval(Picup2.hashObserverId);
Picup2.currentHash = window.location.hash;
var hash = window.location.hash.replace(/^\#/, '');
var paramKVs = hash.split('&');
var paramHash = {};
for (var p = 0; p < paramKVs.length; p++) {
var kvp = paramKVs[p];
var kv = kvp.replace('=', '&').split('&');
paramHash[kv[0]] = kv[1];
}
Picup2.callbackHandler(paramHash);
}
},
urlForOptions: function (action, options) {
var url = Picup2.customURLScheme + action + '?';
var params = [];
for (var param in options) {
optionValue = options[param];
paramLowerCase = param.toLowerCase();
if ((paramLowerCase == 'callbackurl' || paramLowerCase == 'cancelurl') && Picup2.shouldConvertCallbackURLScheme) {
browserName = MobileBrowserName();
if (browserName == 'Opera') {
optionValue = optionValue.replace(/^http/, 'ohttp');
} else if (browserName == 'Chrome') {
optionValue = optionValue.replace(/^http/, 'googlechrome');
}
}
params.push(param + '=' + optionValue);
}
var uploadURL = url + params.join('&');
return uploadURL;
},
isMobileIOS: function () {
var agent = navigator.userAgent.toLowerCase();
return (agent.indexOf('iphone') != -1) || (agent.indexOf('ipad') != -1);
}
};
function MobileBrowserName() {
var agent = navigator.userAgent.toLowerCase();
if (agent.indexOf('opera') != -1) {
return 'Opera';
} else if (agent.indexOf('crios') != -1) {
return 'Chrome';
}
return 'Safari';
};
(function ($) {
"use strict";
var feature = {};
feature.fileapi = $(" ").get(0).files !== undefined;
feature.formdata = window.FormData !== undefined;
var hasProp = !!$.fn.prop;
$.fn.attr2 = function () {
if (!hasProp)
return this.attr.apply(this, arguments);
var val = this.prop.apply(this, arguments);
if ((val && val.jquery) || typeof val === 'string')
return val;
return this.attr.apply(this, arguments);
};
$.fn.ajaxSubmit = function (options) {
if (!this.length) {
log('ajaxSubmit: skipping submit process - no element selected');
return this;
}
var method, action, url, $form = this;
if (typeof options == 'function') {
options = {success: options};
}
else if (options === undefined) {
options = {};
}
method = options.type || this.attr2('method');
action = options.url || this.attr2('action');
url = (typeof action === 'string') ? $.trim(action) : '';
url = url || window.location.href || '';
if (url) {
url = (url.match(/^([^#]+)/) || [])[1];
}
options = $.extend(true, {
url: url,
success: $.ajaxSettings.success,
type: method || 'GET',
iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank'
}, options);
var veto = {};
this.trigger('form-pre-serialize', [this, options, veto]);
if (veto.veto) {
log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');
return this;
}
if (options.beforeSerialize && options.beforeSerialize(this, options) === false) {
log('ajaxSubmit: submit aborted via beforeSerialize callback');
return this;
}
var traditional = options.traditional;
if (traditional === undefined) {
traditional = $.ajaxSettings.traditional;
}
var elements = [];
var qx, a = this.formToArray(options.semantic, elements);
if (options.data) {
options.extraData = options.data;
qx = $.param(options.data, traditional);
}
if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {
log('ajaxSubmit: submit aborted via beforeSubmit callback');
return this;
}
this.trigger('form-submit-validate', [a, this, options, veto]);
if (veto.veto) {
log('ajaxSubmit: submit vetoed via form-submit-validate trigger');
return this;
}
var q = $.param(a, traditional);
if (qx) {
q = (q ? (q + '&' + qx) : qx);
}
if (options.type.toUpperCase() == 'GET') {
options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
options.data = null;
}
else {
options.data = q;
}
var callbacks = [];
if (options.resetForm) {
callbacks.push(function () {
$form.resetForm();
});
}
if (options.clearForm) {
callbacks.push(function () {
$form.clearForm(options.includeHidden);
});
}
if (!options.dataType && options.target) {
var oldSuccess = options.success || function () {
};
callbacks.push(function (data) {
var fn = options.replaceTarget ? 'replaceWith' : 'html';
$(options.target)[fn](data).each(oldSuccess, arguments);
});
}
else if (options.success) {
callbacks.push(options.success);
}
options.success = function (data, status, xhr) {
var context = options.context || this;
for (var c = 0, max = callbacks.length; c < max; c++) {
callbacks[c].apply(context, [data, status, xhr || $form, $form]);
}
};
if (options.error) {
var oldError = options.error;
options.error = function (xhr, status, error) {
var context = options.context || this;
oldError.apply(context, [xhr, status, error, $form]);
};
}
if (options.complete) {
var oldComplete = options.complete;
options.complete = function (xhr, status) {
var context = options.context || this;
oldComplete.apply(context, [xhr, status, $form]);
};
}
var fileInputs = $('input[type=file]:enabled[value!=""]', this);
var hasFileInputs = fileInputs.length > 0;
var mp = 'multipart/form-data';
var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp);
var fileAPI = feature.fileapi && feature.formdata;
log("fileAPI :" + fileAPI);
var shouldUseFrame = (hasFileInputs || multipart) && !fileAPI;
var jqxhr;
if (options.iframe !== false && (options.iframe || shouldUseFrame)) {
if (options.closeKeepAlive) {
$.get(options.closeKeepAlive, function () {
jqxhr = fileUploadIframe(a);
});
}
else {
jqxhr = fileUploadIframe(a);
}
}
else if ((hasFileInputs || multipart) && fileAPI) {
jqxhr = fileUploadXhr(a);
}
else {
jqxhr = $.ajax(options);
}
$form.removeData('jqxhr').data('jqxhr', jqxhr);
for (var k = 0; k < elements.length; k++)
elements[k] = null;
this.trigger('form-submit-notify', [this, options]);
return this;
function deepSerialize(extraData) {
var serialized = $.param(extraData, options.traditional).split('&');
var len = serialized.length;
var result = [];
var c, part;
for (c = 0; c < len; c++) {
serialized[c] = serialized[c].replace(/\+/g, ' ');
part = serialized[c].split('=');
result.push([decodeURIComponent(part[0]), decodeURIComponent(part[1])]);
}
return result;
}
function fileUploadXhr(a) {
var formdata = new FormData();
for (var c = 0; c < a.length; c++) {
formdata.append(a[c].name, a[c].value);
}
if (options.extraData) {
var serializedData = deepSerialize(options.extraData);
for (c = 0; c < serializedData.length; c++)
if (serializedData[c])
formdata.append(serializedData[c][0], serializedData[c][1]);
}
options.data = null;
var s = $.extend(true, {}, $.ajaxSettings, options, {
contentType: false,
processData: false,
cache: false,
type: method || 'POST'
});
if (options.uploadProgress) {
s.xhr = function () {
var xhr = $.ajaxSettings.xhr();
if (xhr.upload) {
xhr.upload.addEventListener('progress', function (event) {
var percent = 0;
var position = event.loaded || event.position;
var total = event.total;
if (event.lengthComputable) {
percent = Math.ceil(position / total * 100);
}
options.uploadProgress(event, position, total, percent);
}, false);
}
return xhr;
};
}
s.data = null;
var beforeSend = s.beforeSend;
s.beforeSend = function (xhr, o) {
o.data = formdata;
if (beforeSend)
beforeSend.call(this, xhr, o);
};
return $.ajax(s);
}
function fileUploadIframe(a) {
var form = $form[0], el, c, s, g, id, $io, io, xhr, sub, n, timedOut, timeoutHandle;
var deferred = $.Deferred();
if (a) {
for (c = 0; c < elements.length; c++) {
el = $(elements[c]);
if (hasProp)
el.prop('disabled', false); else
el.removeAttr('disabled');
}
}
s = $.extend(true, {}, $.ajaxSettings, options);
s.context = s.context || s;
id = 'jqFormIO' + (new Date().getTime());
if (s.iframeTarget) {
$io = $(s.iframeTarget);
n = $io.attr2('name');
if (!n)
$io.attr2('name', id); else
id = n;
}
else {
$io = $('');
$io.css({position: 'absolute', top: '-1000px', left: '-1000px'});
}
io = $io[0];
xhr = {
aborted: 0,
responseText: null,
responseXML: null,
status: 0,
statusText: 'n/a',
getAllResponseHeaders: function () {
},
getResponseHeader: function () {
},
setRequestHeader: function () {
},
abort: function (status) {
var e = (status === 'timeout' ? 'timeout' : 'aborted');
log('aborting upload... ' + e);
this.aborted = 1;
try {
if (io.contentWindow.document.execCommand) {
io.contentWindow.document.execCommand('Stop');
}
}
catch (ignore) {
}
$io.attr('src', s.iframeSrc);
xhr.error = e;
if (s.error)
s.error.call(s.context, xhr, e, status);
if (g)
$.event.trigger("ajaxError", [xhr, s, e]);
if (s.complete)
s.complete.call(s.context, xhr, e);
}
};
g = s.global;
if (g && 0 === $.active++) {
$.event.trigger("ajaxStart");
}
if (g) {
$.event.trigger("ajaxSend", [xhr, s]);
}
if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {
if (s.global) {
$.active--;
}
deferred.reject();
return deferred;
}
if (xhr.aborted) {
deferred.reject();
return deferred;
}
sub = form.clk;
if (sub) {
n = sub.name;
if (n && !sub.disabled) {
s.extraData = s.extraData || {};
s.extraData[n] = sub.value;
if (sub.type == "image") {
s.extraData[n + '.x'] = form.clk_x;
s.extraData[n + '.y'] = form.clk_y;
}
}
}
var CLIENT_TIMEOUT_ABORT = 1;
var SERVER_ABORT = 2;
function getDoc(frame) {
var doc = null;
try {
if (frame.contentWindow) {
doc = frame.contentWindow.document;
}
} catch (err) {
log('cannot get iframe.contentWindow document: ' + err);
}
if (doc) {
return doc;
}
try {
doc = frame.contentDocument ? frame.contentDocument : frame.document;
} catch (err) {
log('cannot get iframe.contentDocument: ' + err);
doc = frame.document;
}
return doc;
}
var csrf_token = $('meta[name=csrf-token]').attr('content');
var csrf_param = $('meta[name=csrf-param]').attr('content');
if (csrf_param && csrf_token) {
s.extraData = s.extraData || {};
s.extraData[csrf_param] = csrf_token;
}
function doSubmit() {
var t = $form.attr2('target'), a = $form.attr2('action');
form.setAttribute('target', id);
if (!method) {
form.setAttribute('method', 'POST');
}
if (a != s.url) {
form.setAttribute('action', s.url);
}
if (!s.skipEncodingOverride && (!method || /post/i.test(method))) {
$form.attr({encoding: 'multipart/form-data', enctype: 'multipart/form-data'});
}
if (s.timeout) {
timeoutHandle = setTimeout(function () {
timedOut = true;
cb(CLIENT_TIMEOUT_ABORT);
}, s.timeout);
}
function checkState() {
try {
var state = getDoc(io).readyState;
log('state = ' + state);
if (state && state.toLowerCase() == 'uninitialized')
setTimeout(checkState, 50);
}
catch (e) {
log('Server abort: ', e, ' (', e.name, ')');
cb(SERVER_ABORT);
if (timeoutHandle)
clearTimeout(timeoutHandle);
timeoutHandle = undefined;
}
}
var extraInputs = [];
try {
if (s.extraData) {
for (var n in s.extraData) {
if (s.extraData.hasOwnProperty(n)) {
if ($.isPlainObject(s.extraData[n]) && s.extraData[n].hasOwnProperty('name') && s.extraData[n].hasOwnProperty('value')) {
extraInputs.push($(' ').val(s.extraData[n].value).appendTo(form)[0]);
} else {
extraInputs.push($(' ').val(s.extraData[n]).appendTo(form)[0]);
}
}
}
}
if (!s.iframeTarget) {
$io.appendTo('body');
if (io.attachEvent)
io.attachEvent('onload', cb); else
io.addEventListener('load', cb, false);
}
setTimeout(checkState, 15);
try {
form.submit();
} catch (err) {
var submitFn = document.createElement('form').submit;
submitFn.apply(form);
}
}
finally {
form.setAttribute('action', a);
if (t) {
form.setAttribute('target', t);
} else {
$form.removeAttr('target');
}
$(extraInputs).remove();
}
}
if (s.forceSync) {
doSubmit();
}
else {
setTimeout(doSubmit, 10);
}
var data, doc, domCheckCount = 50, callbackProcessed;
function cb(e) {
if (xhr.aborted || callbackProcessed) {
return;
}
doc = getDoc(io);
if (!doc) {
log('cannot access response document');
e = SERVER_ABORT;
}
if (e === CLIENT_TIMEOUT_ABORT && xhr) {
xhr.abort('timeout');
deferred.reject(xhr, 'timeout');
return;
}
else if (e == SERVER_ABORT && xhr) {
xhr.abort('server abort');
deferred.reject(xhr, 'error', 'server abort');
return;
}
if (!doc || doc.location.href == s.iframeSrc) {
if (!timedOut)
return;
}
if (io.detachEvent)
io.detachEvent('onload', cb); else
io.removeEventListener('load', cb, false);
var status = 'success', errMsg;
try {
if (timedOut) {
throw'timeout';
}
var isXml = s.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc);
log('isXml=' + isXml);
if (!isXml && window.opera && (doc.body === null || !doc.body.innerHTML)) {
if (--domCheckCount) {
log('requeing onLoad callback, DOM not available');
setTimeout(cb, 250);
return;
}
}
var docRoot = doc.body ? doc.body : doc.documentElement;
xhr.responseText = docRoot ? docRoot.innerHTML : null;
xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
if (isXml)
s.dataType = 'xml';
xhr.getResponseHeader = function (header) {
var headers = {'content-type': s.dataType};
return headers[header];
};
if (docRoot) {
xhr.status = Number(docRoot.getAttribute('status')) || xhr.status;
xhr.statusText = docRoot.getAttribute('statusText') || xhr.statusText;
}
var dt = (s.dataType || '').toLowerCase();
var scr = /(json|script|text)/.test(dt);
if (scr || s.textarea) {
var ta = doc.getElementsByTagName('textarea')[0];
if (ta) {
xhr.responseText = ta.value;
xhr.status = Number(ta.getAttribute('status')) || xhr.status;
xhr.statusText = ta.getAttribute('statusText') || xhr.statusText;
}
else if (scr) {
var pre = doc.getElementsByTagName('pre')[0];
var b = doc.getElementsByTagName('body')[0];
if (pre) {
xhr.responseText = pre.textContent ? pre.textContent : pre.innerText;
}
else if (b) {
xhr.responseText = b.textContent ? b.textContent : b.innerText;
}
}
}
else if (dt == 'xml' && !xhr.responseXML && xhr.responseText) {
xhr.responseXML = toXml(xhr.responseText);
}
try {
data = httpData(xhr, dt, s);
}
catch (err) {
status = 'parsererror';
xhr.error = errMsg = (err || status);
}
}
catch (err) {
log('error caught: ', err);
status = 'error';
xhr.error = errMsg = (err || status);
}
if (xhr.aborted) {
log('upload aborted');
status = null;
}
if (xhr.status) {
status = (xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) ? 'success' : 'error';
}
if (status === 'success') {
if (s.success)
s.success.call(s.context, data, 'success', xhr);
deferred.resolve(xhr.responseText, 'success', xhr);
if (g)
$.event.trigger("ajaxSuccess", [xhr, s]);
}
else if (status) {
if (errMsg === undefined)
errMsg = xhr.statusText;
if (s.error)
s.error.call(s.context, xhr, status, errMsg);
deferred.reject(xhr, 'error', errMsg);
if (g)
$.event.trigger("ajaxError", [xhr, s, errMsg]);
}
if (g)
$.event.trigger("ajaxComplete", [xhr, s]);
if (g && !--$.active) {
$.event.trigger("ajaxStop");
}
if (s.complete)
s.complete.call(s.context, xhr, status);
callbackProcessed = true;
if (s.timeout)
clearTimeout(timeoutHandle);
setTimeout(function () {
if (!s.iframeTarget)
$io.remove();
xhr.responseXML = null;
}, 100);
}
var toXml = $.parseXML || function (s, doc) {
if (window.ActiveXObject) {
doc = new ActiveXObject('Microsoft.XMLDOM');
doc.async = 'false';
doc.loadXML(s);
}
else {
doc = (new DOMParser()).parseFromString(s, 'text/xml');
}
return (doc && doc.documentElement && doc.documentElement.nodeName != 'parsererror') ? doc : null;
};
var parseJSON = $.parseJSON || function (s) {
return window['eval']('(' + s + ')');
};
var httpData = function (xhr, type, s) {
var ct = xhr.getResponseHeader('content-type') || '',
xml = type === 'xml' || !type && ct.indexOf('xml') >= 0,
data = xml ? xhr.responseXML : xhr.responseText;
if (xml && data.documentElement.nodeName === 'parsererror') {
if ($.error)
$.error('parsererror');
}
if (s && s.dataFilter) {
data = s.dataFilter(data, type);
}
if (typeof data === 'string') {
if (type === 'json' || !type && ct.indexOf('json') >= 0) {
data = parseJSON(data);
} else if (type === "script" || !type && ct.indexOf("javascript") >= 0) {
$.globalEval(data);
}
}
return data;
};
return deferred;
}
};
$.fn.ajaxForm = function (options) {
options = options || {};
options.delegation = options.delegation && $.isFunction($.fn.on);
if (!options.delegation && this.length === 0) {
var o = {s: this.selector, c: this.context};
if (!$.isReady && o.s) {
log('DOM not ready, queuing ajaxForm');
$(function () {
$(o.s, o.c).ajaxForm(options);
});
return this;
}
log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
return this;
}
if (options.delegation) {
$(document).off('submit.form-plugin', this.selector, doAjaxSubmit).off('click.form-plugin', this.selector, captureSubmittingElement).on('submit.form-plugin', this.selector, options, doAjaxSubmit).on('click.form-plugin', this.selector, options, captureSubmittingElement);
return this;
}
return this.ajaxFormUnbind().bind('submit.form-plugin', options, doAjaxSubmit).bind('click.form-plugin', options, captureSubmittingElement);
};
function doAjaxSubmit(e) {
var options = e.data;
if (!e.isDefaultPrevented()) {
e.preventDefault();
$(this).ajaxSubmit(options);
}
}
function captureSubmittingElement(e) {
var target = e.target;
var $el = $(target);
if (!($el.is("[type=submit],[type=image]"))) {
var t = $el.closest('[type=submit]');
if (t.length === 0) {
return;
}
target = t[0];
}
var form = this;
form.clk = target;
if (target.type == 'image') {
if (e.offsetX !== undefined) {
form.clk_x = e.offsetX;
form.clk_y = e.offsetY;
} else if (typeof $.fn.offset == 'function') {
var offset = $el.offset();
form.clk_x = e.pageX - offset.left;
form.clk_y = e.pageY - offset.top;
} else {
form.clk_x = e.pageX - target.offsetLeft;
form.clk_y = e.pageY - target.offsetTop;
}
}
setTimeout(function () {
form.clk = form.clk_x = form.clk_y = null;
}, 100);
}
$.fn.ajaxFormUnbind = function () {
return this.unbind('submit.form-plugin click.form-plugin');
};
$.fn.formToArray = function (semantic, elements) {
var a = [];
if (this.length === 0) {
return a;
}
var form = this[0];
var els = semantic ? form.getElementsByTagName('*') : form.elements;
if (!els) {
return a;
}
var c, j, n, v, el, max, jmax;
for (c = 0, max = els.length; c < max; c++) {
el = els[c];
n = el.name;
if (!n || el.disabled) {
continue;
}
if (semantic && form.clk && el.type == "image") {
if (form.clk == el) {
a.push({name: n, value: $(el).val(), type: el.type});
a.push({name: n + '.x', value: form.clk_x}, {name: n + '.y', value: form.clk_y});
}
continue;
}
v = $.fieldValue(el, true);
if (v && v.constructor == Array) {
if (elements)
elements.push(el);
for (j = 0, jmax = v.length; j < jmax; j++) {
a.push({name: n, value: v[j]});
}
}
else if (feature.fileapi && el.type == 'file') {
if (elements)
elements.push(el);
var files = el.files;
if (files.length) {
for (j = 0; j < files.length; j++) {
a.push({name: n, value: files[j], type: el.type});
}
}
else {
a.push({name: n, value: '', type: el.type});
}
}
else if (v !== null && typeof v != 'undefined') {
if (elements)
elements.push(el);
a.push({name: n, value: v, type: el.type, required: el.required});
}
}
if (!semantic && form.clk) {
var $input = $(form.clk), input = $input[0];
n = input.name;
if (n && !input.disabled && input.type == 'image') {
a.push({name: n, value: $input.val()});
a.push({name: n + '.x', value: form.clk_x}, {name: n + '.y', value: form.clk_y});
}
}
return a;
};
$.fn.formSerialize = function (semantic) {
return $.param(this.formToArray(semantic));
};
$.fn.fieldSerialize = function (successful) {
var a = [];
this.each(function () {
var n = this.name;
if (!n) {
return;
}
var v = $.fieldValue(this, successful);
if (v && v.constructor == Array) {
for (var c = 0, max = v.length; c < max; c++) {
a.push({name: n, value: v[c]});
}
}
else if (v !== null && typeof v != 'undefined') {
a.push({name: this.name, value: v});
}
});
return $.param(a);
};
$.fn.fieldValue = function (successful) {
for (var val = [], c = 0, max = this.length; c < max; c++) {
var el = this[c];
var v = $.fieldValue(el, successful);
if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length)) {
continue;
}
if (v.constructor == Array)
$.merge(val, v); else
val.push(v);
}
return val;
};
$.fieldValue = function (el, successful) {
var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
if (successful === undefined) {
successful = true;
}
if (successful && (!n || el.disabled || t == 'reset' || t == 'button' || (t == 'checkbox' || t == 'radio') && !el.checked || (t == 'submit' || t == 'image') && el.form && el.form.clk != el || tag == 'select' && el.selectedIndex == -1)) {
return null;
}
if (tag == 'select') {
var index = el.selectedIndex;
if (index < 0) {
return null;
}
var a = [], ops = el.options;
var one = (t == 'select-one');
var max = (one ? index + 1 : ops.length);
for (var c = (one ? index : 0); c < max; c++) {
var op = ops[c];
if (op.selected) {
var v = op.value;
if (!v) {
v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value;
}
if (one) {
return v;
}
a.push(v);
}
}
return a;
}
return $(el).val();
};
$.fn.clearForm = function (includeHidden) {
return this.each(function () {
$('input,select,textarea', this).clearFields(includeHidden);
});
};
$.fn.clearFields = $.fn.clearInputs = function (includeHidden) {
var re = /^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i;
return this.each(function () {
var t = this.type, tag = this.tagName.toLowerCase();
if (re.test(t) || tag == 'textarea') {
this.value = '';
}
else if (t == 'checkbox' || t == 'radio') {
this.checked = false;
}
else if (tag == 'select') {
this.selectedIndex = -1;
}
else if (t == "file") {
if (/MSIE/.test(navigator.userAgent)) {
$(this).replaceWith($(this).clone(true));
} else {
$(this).val('');
}
}
else if (includeHidden) {
if ((includeHidden === true && /hidden/.test(t)) || (typeof includeHidden == 'string' && $(this).is(includeHidden)))
this.value = '';
}
});
};
$.fn.resetForm = function () {
return this.each(function () {
if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType)) {
this.reset();
}
});
};
$.fn.enable = function (b) {
if (b === undefined) {
b = true;
}
return this.each(function () {
this.disabled = !b;
});
};
$.fn.selected = function (select) {
if (select === undefined) {
select = true;
}
return this.each(function () {
var t = this.type;
if (t == 'checkbox' || t == 'radio') {
this.checked = select;
}
else if (this.tagName.toLowerCase() == 'option') {
var $sel = $(this).parent('select');
if (select && $sel[0] && $sel[0].type == 'select-one') {
$sel.find('option').selected(false);
}
this.selected = select;
}
});
};
$.fn.ajaxSubmit.debug = false;
function log() {
if (!$.fn.ajaxSubmit.debug)
return;
var msg = '[jquery.form] ' + Array.prototype.join.call(arguments, '');
if (window.console && window.console.log) {
window.console.log(msg);
}
else if (window.opera && window.opera.postError) {
window.opera.postError(msg);
}
}
})(jQuery);
(function (factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
define(['jquery'], factory);
} else {
factory(jQuery);
}
}
(function ($) {
'use strict';
var utils = (function () {
return {
escapeRegExChars: function (value) {
return value.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
}, createNode: function (html) {
var div = document.createElement('div');
div.innerHTML = html;
return div.firstChild;
}
};
}()), keys = {ESC: 27, TAB: 9, RETURN: 13, LEFT: 37, UP: 38, RIGHT: 39, DOWN: 40};
function Autocomplete(el, options) {
var noop = function () {
}, that = this, defaults = {
autoSelectFirst: false,
appendTo: 'body',
serviceUrl: null,
lookup: null,
onSelect: null,
width: 'auto',
minChars: 1,
maxHeight: 300,
deferRequestBy: 0,
params: {},
formatResult: Autocomplete.formatResult,
delimiter: null,
zIndex: 9999,
type: 'GET',
noCache: false,
onSearchStart: noop,
onSearchComplete: noop,
containerClass: 'autocomplete-suggestions',
tabDisabled: false,
dataType: 'text',
currentRequest: null,
lookupFilter: function (suggestion, originalQuery, queryLowerCase) {
return suggestion.value.toLowerCase().indexOf(queryLowerCase) !== -1;
},
paramName: 'query',
transformResult: function (response) {
return typeof response === 'string' ? $.parseJSON(response) : response;
}
};
that.element = el;
that.el = $(el);
that.suggestions = [];
that.badQueries = [];
that.selectedIndex = -1;
that.currentValue = that.element.value;
that.intervalId = 0;
that.cachedResponse = [];
that.onChangeInterval = null;
that.onChange = null;
that.isLocal = false;
that.suggestionsContainer = null;
that.options = $.extend({}, defaults, options);
that.classes = {selected: 'autocomplete-selected', suggestion: 'autocomplete-suggestion'};
that.hint = null;
that.hintValue = '';
that.selection = null;
that.initialize();
that.setOptions(options);
}
Autocomplete.utils = utils;
$.Autocomplete = Autocomplete;
Autocomplete.formatResult = function (suggestion, currentValue) {
var pattern = '(' + utils.escapeRegExChars(currentValue) + ')';
return suggestion.value.replace(new RegExp(pattern, 'gi'), '$1<\/strong>');
};
Autocomplete.prototype = {
killerFn: null, initialize: function () {
var that = this, suggestionSelector = '.'
+ that.classes.suggestion, selected = that.classes.selected, options = that.options, container;
that.element.setAttribute('autocomplete', 'off');
that.killerFn = function (e) {
if ($(e.target).closest('.' + that.options.containerClass).length === 0) {
that.killSuggestions();
that.disableKillerFn();
}
};
that.suggestionsContainer = Autocomplete.utils.createNode('
');
container = $(that.suggestionsContainer);
container.appendTo(options.appendTo);
if (options.width !== 'auto') {
container.width(options.width);
}
container.on('mouseover.autocomplete', suggestionSelector, function () {
that.activate($(this).data('index'));
});
container.on('mouseout.autocomplete', function () {
that.selectedIndex = -1;
container.children('.' + selected).removeClass(selected);
});
container.on('click.autocomplete', suggestionSelector, function () {
that.select($(this).data('index'));
});
that.fixPosition();
that.fixPositionCapture = function () {
if (that.visible) {
that.fixPosition();
}
};
$(window).on('resize', that.fixPositionCapture);
that.el.on('keydown.autocomplete', function (e) {
that.onKeyPress(e);
});
that.el.on('keyup.autocomplete', function (e) {
that.onKeyUp(e);
});
that.el.on('blur.autocomplete', function () {
that.onBlur();
});
that.el.on('focus.autocomplete', function () {
that.fixPosition();
});
that.el.on('change.autocomplete', function (e) {
that.onKeyUp(e);
});
}, onBlur: function () {
this.enableKillerFn();
}, setOptions: function (suppliedOptions) {
var that = this, options = that.options;
$.extend(options, suppliedOptions);
that.isLocal = $.isArray(options.lookup);
if (that.isLocal) {
options.lookup = that.verifySuggestionsFormat(options.lookup);
}
$(that.suggestionsContainer).css({
'max-height': options.maxHeight + 'px',
'width': options.width + 'px',
'z-index': options.zIndex
});
}, clearCache: function () {
this.cachedResponse = [];
this.badQueries = [];
}, clear: function () {
this.clearCache();
this.currentValue = '';
this.suggestions = [];
}, disable: function () {
this.disabled = true;
}, enable: function () {
this.disabled = false;
}, fixPosition: function () {
var that = this, offset;
if (that.options.appendTo !== 'body') {
return;
}
offset = that.el.offset();
$(that.suggestionsContainer).css({
top: (offset.top + that.el.outerHeight()) + 'px',
left: offset.left + 'px'
});
}, enableKillerFn: function () {
var that = this;
$(document).on('click.autocomplete', that.killerFn);
}, disableKillerFn: function () {
var that = this;
$(document).off('click.autocomplete', that.killerFn);
}, killSuggestions: function () {
var that = this;
that.stopKillSuggestions();
that.intervalId = window.setInterval(function () {
that.hide();
that.stopKillSuggestions();
}, 300);
}, stopKillSuggestions: function () {
window.clearInterval(this.intervalId);
}, isCursorAtEnd: function () {
var that = this, valLength = that.el.val().length, selectionStart = that.element.selectionStart, range;
if (typeof selectionStart === 'number') {
return selectionStart === valLength;
}
if (document.selection) {
range = document.selection.createRange();
range.moveStart('character', -valLength);
return valLength === range.text.length;
}
return true;
}, onKeyPress: function (e) {
var that = this;
if (!that.disabled && !that.visible && e.which === keys.DOWN && that.currentValue) {
that.suggest();
return;
}
if (that.disabled || !that.visible) {
return;
}
switch (e.which) {
case keys.ESC:
that.el.val(that.currentValue);
that.hide();
break;
case keys.RIGHT:
if (that.hint && that.options.onHint && that.isCursorAtEnd()) {
that.selectHint();
break;
}
return;
case keys.TAB:
if (that.hint && that.options.onHint) {
that.selectHint();
return;
}
case keys.RETURN:
if (that.selectedIndex === -1) {
that.hide();
return;
}
that.select(that.selectedIndex);
if (e.which === keys.TAB && that.options.tabDisabled === false) {
return;
}
break;
case keys.UP:
that.moveUp();
break;
case keys.DOWN:
that.moveDown();
break;
default:
return;
}
e.stopImmediatePropagation();
e.preventDefault();
}, onKeyUp: function (e) {
var that = this;
if (that.disabled) {
return;
}
switch (e.which) {
case keys.UP:
case keys.DOWN:
return;
}
clearInterval(that.onChangeInterval);
if (that.currentValue !== that.el.val()) {
that.findBestHint();
if (that.options.deferRequestBy > 0) {
that.onChangeInterval = setInterval(function () {
that.onValueChange();
}, that.options.deferRequestBy);
} else {
that.onValueChange();
}
}
}, onValueChange: function () {
var that = this, q;
if (that.selection) {
that.selection = null;
(that.options.onInvalidateSelection || $.noop)();
}
clearInterval(that.onChangeInterval);
that.currentValue = that.el.val();
q = that.getQuery(that.currentValue);
that.selectedIndex = -1;
if (q.length < that.options.minChars) {
that.hide();
} else {
that.getSuggestions(q);
}
}, getQuery: function (value) {
var delimiter = this.options.delimiter, parts;
if (!delimiter) {
return $.trim(value);
}
parts = value.split(delimiter);
return $.trim(parts[parts.length - 1]);
}, getSuggestionsLocal: function (query) {
var that = this, queryLowerCase = query.toLowerCase(), filter = that.options.lookupFilter;
return {
suggestions: $.grep(that.options.lookup, function (suggestion) {
return filter(suggestion, query, queryLowerCase);
})
};
}, getSuggestions: function (q) {
var response, that = this, options = that.options, serviceUrl = options.serviceUrl;
response = that.isLocal ? that.getSuggestionsLocal(q) : that.cachedResponse[q];
if (response && $.isArray(response.suggestions)) {
that.suggestions = response.suggestions;
that.suggest();
} else if (!that.isBadQuery(q)) {
options.params[options.paramName] = q;
if (options.onSearchStart.call(that.element, options.params) === false) {
return;
}
if ($.isFunction(options.serviceUrl)) {
serviceUrl = options.serviceUrl.call(that.element, q);
}
if (this.currentRequest != null) {
this.currentRequest.abort();
}
this.currentRequest = $.ajax({
url: serviceUrl,
data: options.ignoreParams ? null : options.params,
type: options.type,
dataType: options.dataType
}).done(function (data) {
that.processResponse(data, q);
options.onSearchComplete.call(that.element, q);
});
}
}, isBadQuery: function (q) {
var badQueries = this.badQueries, c = badQueries.length;
while (c--) {
if (q.indexOf(badQueries[c]) === 0) {
return true;
}
}
return false;
}, hide: function () {
var that = this;
that.visible = false;
that.selectedIndex = -1;
$(that.suggestionsContainer).hide();
that.signalHint(null);
}, suggest: function () {
if (this.suggestions.length === 0) {
this.hide();
return;
}
var that = this, formatResult = that.options.formatResult, value = that.getQuery(that.currentValue),
className = that.classes.suggestion, classSelected = that.classes.selected,
container = $(that.suggestionsContainer), html = '', width;
$.each(that.suggestions, function (c, suggestion) {
html += '' + formatResult(suggestion, value)
+ '
';
});
if (that.options.width === 'auto') {
width = that.el.outerWidth() - 2;
container.width(width > 0 ? width : 300);
}
container.html(html).show();
that.visible = true;
if (that.options.autoSelectFirst) {
that.selectedIndex = 0;
container.children().first().addClass(classSelected);
}
that.findBestHint();
}, findBestHint: function () {
var that = this, value = that.el.val().toLowerCase(), bestMatch = null;
if (!value) {
return;
}
$.each(that.suggestions, function (c, suggestion) {
var foundMatch = suggestion.value.toLowerCase().indexOf(value) === 0;
if (foundMatch) {
bestMatch = suggestion;
}
return !foundMatch;
});
that.signalHint(bestMatch);
}, signalHint: function (suggestion) {
var hintValue = '', that = this;
if (suggestion) {
hintValue = that.currentValue
+ suggestion.value.substr(that.currentValue.length);
}
if (that.hintValue !== hintValue) {
that.hintValue = hintValue;
that.hint = suggestion;
(this.options.onHint || $.noop)(hintValue);
}
}, verifySuggestionsFormat: function (suggestions) {
if (suggestions.length && typeof suggestions[0] === 'string') {
return $.map(suggestions, function (value) {
return {value: value, data: null};
});
}
return suggestions;
}, processResponse: function (response, originalQuery) {
var that = this, options = that.options, result = options.transformResult(response, originalQuery);
result.suggestions = that.verifySuggestionsFormat(result.suggestions);
if (!options.noCache) {
that.cachedResponse[result[options.paramName]] = result;
if (result.suggestions.length === 0) {
that.badQueries.push(result[options.paramName]);
}
}
if (originalQuery === that.getQuery(that.currentValue)) {
that.suggestions = result.suggestions;
that.suggest();
}
}, activate: function (index) {
var that = this, activeItem, selected = that.classes.selected, container = $(that.suggestionsContainer),
children = container.children();
container.children('.' + selected).removeClass(selected);
that.selectedIndex = index;
if (that.selectedIndex !== -1 && children.length > that.selectedIndex) {
activeItem = children.get(that.selectedIndex);
$(activeItem).addClass(selected);
return activeItem;
}
return null;
}, selectHint: function () {
var that = this, c = $.inArray(that.hint, that.suggestions);
that.select(c);
}, select: function (c) {
var that = this;
that.hide();
that.onSelect(c);
}, moveUp: function () {
var that = this;
if (that.selectedIndex === -1) {
return;
}
if (that.selectedIndex === 0) {
$(that.suggestionsContainer).children().first().removeClass(that.classes.selected);
that.selectedIndex = -1;
that.el.val(that.currentValue);
that.findBestHint();
return;
}
that.adjustScroll(that.selectedIndex - 1);
}, moveDown: function () {
var that = this;
if (that.selectedIndex === (that.suggestions.length - 1)) {
return;
}
that.adjustScroll(that.selectedIndex + 1);
}, adjustScroll: function (index) {
var that = this, activeItem = that.activate(index), offsetTop, upperBound, lowerBound, heightDelta = 25;
if (!activeItem) {
return;
}
offsetTop = activeItem.offsetTop;
upperBound = $(that.suggestionsContainer).scrollTop();
lowerBound = upperBound + that.options.maxHeight
- heightDelta;
if (offsetTop < upperBound) {
$(that.suggestionsContainer).scrollTop(offsetTop);
} else if (offsetTop > lowerBound) {
$(that.suggestionsContainer).scrollTop(offsetTop - that.options.maxHeight
+ heightDelta);
}
that.el.val(that.getValue(that.suggestions[index].value));
that.signalHint(null);
}, onSelect: function (index) {
var that = this, onSelectCallback = that.options.onSelect, suggestion = that.suggestions[index];
that.currentValue = that.getValue(suggestion.value);
that.el.val(that.currentValue);
that.signalHint(null);
that.suggestions = [];
that.selection = suggestion;
if ($.isFunction(onSelectCallback)) {
onSelectCallback.call(that.element, suggestion);
}
}, getValue: function (value) {
var that = this, delimiter = that.options.delimiter, currentValue, parts;
if (!delimiter) {
return value;
}
currentValue = that.currentValue;
parts = currentValue.split(delimiter);
if (parts.length === 1) {
return value;
}
return currentValue.substr(0, currentValue.length
- parts[parts.length - 1].length)
+ value;
}, dispose: function () {
var that = this;
that.el.off('.autocomplete').removeData('autocomplete');
that.disableKillerFn();
$(window).off('resize', that.fixPositionCapture);
$(that.suggestionsContainer).remove();
}
};
$.fn.autocomplete = function (options, args) {
var dataKey = 'autocomplete';
if (arguments.length === 0) {
return this.first().data(dataKey);
}
return this.each(function () {
var inputElement = $(this), instance = inputElement.data(dataKey);
if (typeof options === 'string') {
if (instance && typeof instance[options] === 'function') {
instance[options](args);
}
} else {
if (instance && instance.dispose) {
instance.dispose();
}
instance = new Autocomplete(this, options);
inputElement.data(dataKey, instance);
}
});
};
}));
$(document).ready(function () {
$('.title').hover(function () {
var title = $(this).attr('title');
if (title != null) {
$(this).data('tipText', title).removeAttr('title');
$('
').text(title).appendTo('body').fadeIn();
}
}, function () {
$(this).attr('title', $(this).data('tipText'));
$('.tooltip').remove();
}).mousemove(function (e) {
var mousex = e.pageX - 20;
var mousey = e.pageY - 60;
$('.tooltip').css({top: mousey, left: mousex})
});
});
function runMiniClock() {
var time = new Date();
var hours = time.getHours();
var minutes = time.getMinutes();
minutes = ((minutes < 10) ? "0" : "") + minutes;
hours = (hours == 0) ? 12 : hours;
var clock = hours + ":" + minutes;
$("#miniclock").html(clock);
timer = setTimeout("runMiniClock()", 1000);
}
runMiniClock();
(function ($) {
$.fn.touchwipe = function (settings) {
var config = {
min_move_x: 20, min_move_y: 20, wipeLeft: function () {
}, wipeRight: function () {
}, wipeUp: function () {
}, wipeDown: function () {
}, preventDefaultEvents: true
};
if (settings) $.extend(config, settings);
this.each(function () {
var startX;
var startY;
var isMoving = false;
function cancelTouch() {
this.removeEventListener('touchmove', onTouchMove);
startX = null;
isMoving = false
}
function onTouchMove(e) {
if (config.preventDefaultEvents) {
e.preventDefault()
}
if (isMoving) {
var x = e.touches[0].pageX;
var y = e.touches[0].pageY;
var dx = startX - x;
var dy = startY - y;
if (Math.abs(dx) >= config.min_move_x) {
cancelTouch();
if (dx > 0) {
config.wipeLeft()
} else {
config.wipeRight()
}
} else if (Math.abs(dy) >= config.min_move_y) {
cancelTouch();
if (dy > 0) {
config.wipeDown()
} else {
config.wipeUp()
}
}
}
}
function onTouchStart(e) {
if (e.touches.length == 1) {
startX = e.touches[0].pageX;
startY = e.touches[0].pageY;
isMoving = true;
this.addEventListener('touchmove', onTouchMove, false)
}
}
if ('ontouchstart' in document.documentElement) {
this.addEventListener('touchstart', onTouchStart, false)
}
});
return this
}
})(jQuery);
$(document).ready(function () {
$("#attendance-table").tablesorter();
$(".member-checked").click(function () {
if ($(this).is(":checked")) {
$(this).next().css("background-position", "0 -20px !important");
} else {
$(this).next().css("background-position", "0 0 !important");
}
});
$(".report-categories").change(function () {
var text = $(this).find(":selected").text();
if (text == '---')
text = "";
$(this).prev().val(text);
});
$(".report-questions").bind("change", function () {
var text = $(this).find(":selected").text();
if (text == '---')
text = "";
$(this).prev().val(text);
});
$("#clear-report").click(function () {
$("#origin").html("");
});
$(".remove-report-category").click(function () {
$(this).parent().parent().parent().parent().remove();
});
$(".remove-report-question").click(function () {
$(this).parent().parent().parent().remove();
});
var c = $(".report-category").length;
var q = $(".singleq").length;
var i = c + q;
$(".add-report-category").click(function () {
addCategory("origin", null);
});
$(".add-report-category-before").click(function () {
addCategory("origin", null);
});
$(".report-remove-option").bind("click", function () {
$(this).parent().parent().remove();
});
$(".add-main-report-question").click(function () {
var q = $(".singleq").length;
addQuestion("origin", null, q + 1);
});
$(".add-main-report-question-before").click(function () {
var q = $(".singleq").length;
addQuestion("origin", null, q + 1);
});
$(".add-report-question").bind("click", function () {
var q = $(".singleq").length;
addQuestion($(this), String($(this).data("category")), q + 1);
});
$(".add-report-question-before").bind("click", function () {
var q = $(".singleq").length;
addQuestion($(this), String($(this).data("category")), q + 1);
});
$('body').on('click', '.report-question-add-option', function () {
addOption($(this));
});
$('body').on('change', '.question-type', function () {
var rqid = $(this).data("id");
var type = $(this).val();
var url = getUrl();
var is_method = url.substring(url.lastIndexOf('/') + 1);
if (is_method.substr(-3, 3) == ".do")
url = url.substr(0, url.length - is_method.length);
$("#question-config-" + rqid).load(url + "/getQuestionConfigAjax.do", {"id": rqid, "type": type});
});
$(".add-player").click(function () {
var players = getPlayers();
if (players === null) {
return;
}
$(".player-list").append(players);
});
$("#ajax-loading").dialog({
height: 150,
width: 300,
modal: true,
show: 'fade',
title: "Lade Daten",
position: ["center", "center"],
autoOpen: false,
buttons: [
{
text: "",
"class": 'btn fa fa-close',
click: function () {
$('#ajax-loading').dialog("close");
}
}
]
});
$("#update-date-dialog").dialog({
height: 150,
width: 300,
modal: true,
show: 'fade',
title: "Datum ändern",
position: ["center", "center"],
autoOpen: false,
buttons: {
"Schließen": function () {
$(this).dialog("close");
}, "Speichern": function () {
$("#update-date-form").submit();
$(this).dialog("close");
}
},
create: function () {
$(this).closest(".ui-dialog").find("button:first").addClass("btn float-left");
$(this).closest(".ui-dialog").find("button:last").addClass("btn btn-info");
}
});
$("select[name='type'].trainer-news-select").change(function () {
$("#ajax-loading").dialog("open");
var type = $(this).val();
var player = $("select[name='player']").val();
var url = getUrl();
var is_method = url.substring(url.lastIndexOf('/') + 1);
if (is_method.substr(-3, 3) == ".do")
url = url.substr(0, url.length - is_method.length);
$.post(url + "/getInfos.do", {type: type, player: player}, function (data) {
$("#ajax-loading").dialog("close");
$("#trainer-news-content").empty();
$("#trainer-news-content").append(data);
});
});
$("select[name='player'].trainer-news-select").change(function () {
$("#ajax-loading").dialog("open");
var type = $("select[name='type']").val();
var player = $(this).val();
var url = getUrl();
var is_method = url.substring(url.lastIndexOf('/') + 1);
if (is_method.substr(-3, 3) == ".do")
url = url.substr(0, url.length - is_method.length);
$.post(url + "/getInfos.do", {type: type, player: player}, function (data) {
$("#ajax-loading").dialog("close");
$("#trainer-news-content").empty();
$("#trainer-news-content").append(data);
});
});
$(".trainer-news").click(function () {
var url = getUrl();
var is_method = url.substring(url.lastIndexOf('/') + 1);
if (is_method.substr(-3, 3) == ".do")
url = url.substr(0, url.length - is_method.length);
window.location = url + "/mannschaft/trainer-news";
});
$(".trainer-news select").click(function (e) {
e.stopPropagation();
});
$(".window-size").click(function () {
var w = $(this).parent().parent();
var p = $(w).position();
var inner = $(w).find(".inner");
var form = $(w).find(".new-trainer-news");
$(w).css({left: p.left});
if ($(w).width() <= 210) {
$(w).stop().animate({width: 680, height: 500, left: p.left - 470});
$(this).removeClass("icomoon-arrow-up-right");
$(this).addClass("icomoon-arrow-down-left");
$(form).removeClass("hidden");
$(inner).height(383);
} else {
$(w).stop().animate({width: 210, height: 105, left: p.left + 470});
$(this).addClass("icomoon-arrow-up-right");
$(this).removeClass("icomoon-arrow-down-left");
$(form).addClass("hidden");
$(inner).height(60);
}
});
$(".avatar-remove").click(function () {
$("#ajax-loading").dialog("open");
var parent = $(this).parent();
var avatar = $(this).attr("data-avatar");
var id = $(this).attr("data-id");
var url = getUrl();
var is_method = url.substring(url.lastIndexOf('/') + 1);
if (is_method.substr(-3, 3) == ".do")
url = url.substr(0, url.length - is_method.length);
$.post(url + "removeAvatar.do", {avatar: avatar, id: id}, function () {
$("#ajax-loading").dialog("close");
$(parent).remove();
});
});
var bar = $('.bar');
var percent = $('.percent');
var status = $('#status');
$("#document-upload-form").ajaxForm({
beforeSubmit: validate, beforeSend: function () {
var percentVal = '0%';
bar.width(percentVal)
percent.html(percentVal);
$(percent).css({color: "#000"});
}, uploadProgress: function (event, position, total, percentComplete) {
var percentVal = percentComplete + '%';
bar.width(percentVal)
percent.html(percentVal);
if (percentComplete >= 50)
$(percent).css({color: "#fff"});
}, success: function () {
var percentVal = '100%';
bar.width(percentVal)
percent.html(percentVal);
}, complete: function (xhr) {
documentResponse(this, xhr);
}
});
function documentResponse(item, xhr) {
var responsetype = $(xhr.responseText).find("input[class='responsetype']");
var type = "document";
if ($(responsetype).length > 0)
var type = $(responsetype).val();
$("#" + type + "-response").prepend(xhr.responseText);
$(item).find("input[type='file']").empty();
if (type == "document") {
$("#" + type + "-response").find("." + type + "-remove").bind("click", function () {
removeDocument(item);
});
} else {
$("#" + type + "-response").find("." + type + "-remove").unbind("click");
$("#" + type + "-response").find("." + type + "-remove").bind("click", function () {
removeTmpItem(this);
});
$("#" + type + "-response").find(".fb-show-image").unbind("click");
$("#" + type + "-response").find(".fb-show-image").bind("click", function () {
showFbImage(this);
});
}
}
var opp_counter = $(".opp-countable").length;
$(".add-opponent").click(function () {
var opps = getOpps(opp_counter);
var youth = getYouth(opp_counter);
var remove = getRemove();
var teamname = getTeamname();
var rc_cup = getRCCup();
var content = '' + '' +
opps + ' ' + '' +
youth + ' ' + '' +
' ' + ' ' + ' ' + '' +
' ' + ' ' + ' ' + '' +
' ' + ' ' + ' ' + '';
if (rc_cup) {
content += ' ' + ' ' + ' ' + '' + '' + remove + ' ' + ' ' + ' ';
}
$("#ajax-response").append(content);
$(".remove-opponent").unbind("click");
$(".remove-opponent").bind("click", function () {
var check = confirm("Entfernen?");
if (check)
$(this).parent().parent().remove();
});
opp_counter++;
});
$(".remove-opponent").click(function () {
var check = confirm("Entfernen?");
if (check)
$(this).parent().parent().remove();
});
$("#match-players-accordion").accordion({heightStyle: "content", active: false, collapsible: true});
$("#match-info-accordion").accordion({heightStyle: "content", active: false, collapsible: true});
$("#match-ratings-accordion").accordion({heightStyle: "content", active: false, collapsible: true});
$("#match-report-accordion").accordion({heightStyle: "content", active: false, collapsible: true});
$("#match-goals-accordion").accordion({heightStyle: "content", active: false, collapsible: true});
$("#match-cards-accordion").accordion({heightStyle: "content", active: false, collapsible: true});
$("#match-exchanges-accordion").accordion({heightStyle: "content", active: false, collapsible: true});
$("#match-positions-accordion").accordion({heightStyle: "content", active: true, collapsible: true});
$("#match-injuries-accordion").accordion({heightStyle: "content", active: false, collapsible: true});
$("#match-docs-accordion").accordion({heightStyle: "content", active: false, collapsible: true});
$("#match-standard-accordion").accordion({heightStyle: "content", active: false, collapsible: true});
$("#formation-youth-accordion").accordion({heightStyle: "content", active: 1, collapsible: true});
$("#formation-master-accordion").accordion({heightStyle: "content", active: 1, collapsible: true});
$("#formation-team-accordion").accordion({heightStyle: "content", active: 1, collapsible: true});
$("#formation-last-accordion").accordion({heightStyle: "content", active: 1, collapsible: true});
$(".add-guest-player").click(function () {
var p_counter = $(".match-countable").length;
var players = getPlayers(p_counter);
var positions = getGuestPositions(p_counter);
var playerstatus = getGuestPlayerStatus(p_counter);
var remove = getRemove();
var content = '' + '' + ' ' + ' ' + ' ' + '' +
positions + ' ' + '' +
playerstatus + ' ' + '' + 'x ' + ' ' + ' ';
$("#ajax-response").append(content);
$(".remove-match-guest-player").unbind("click");
$(".remove-match-guest-player").bind("click", function () {
var check = confirm("Entfernen?");
if (check)
$(this).parent().parent().remove();
});
p_counter++;
});
$(".remove-match-guest-player").click(function () {
var check = confirm("Entfernen?");
if (check)
$(this).parent().parent().remove();
});
$(".add-match-player").click(function () {
var p_counter = $(".match-countable").length;
var players = getMatchPlayers(p_counter);
var positions = getPositions(p_counter);
var playerstatus = getPlayerStatus(p_counter);
var remove = getRemove();
var content = '' + '' + ' ' + ' ' + ' ' + '' +
positions + ' ' + '' +
playerstatus + ' ' + '' + 'x ' + ' ' + ' ';
$("#ajax-response").append(content);
$("#ajax-response").find("#player-autocomplete-" + p_counter).autocomplete({
serviceUrl: TraiwiJS.prototype.getUrl() + '/lookUpPlayers.do',
maxHeight: 500,
delimiter: " ",
autoSelectFirst: true,
showNoSuggestionNotice: false,
noSuggestionNotice: "Keinen Spieler gefunden",
formatResult: function (suggestion, currentValue) {
var utils = (function () {
return {
escapeRegExChars: function (value) {
return value.replace(
/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
},
createNode: function (html) {
var div = document.createElement('div');
div.innerHTML = html;
return div.firstChild;
}
};
}()),
keys = {
ESC: 27,
TAB: 9,
RETURN: 13,
LEFT: 37,
UP: 38,
RIGHT: 39,
DOWN: 40
};
var pattern = '(' + utils.escapeRegExChars(currentValue) + ')';
var imagesrc = suggestion.avatar;
if (!suggestion.avatar) {
imagesrc = "dfb/no-user.png";
}
return '' +
'' +
' ' +
' ' +
'' +
suggestion.value.replace(new RegExp(pattern, 'gi'), '$1 ') +
' ' + suggestion.team + ' ' +
' ';
},
onSelect: function (suggestion) {
$(this).prev().val(suggestion.data);
$(this).prev().attr("data-id", suggestion.data);
$(this).val(suggestion.value);
$(this).attr("readonly", "true");
}
});
$(".remove-match-player").unbind("click");
$(".remove-match-player").bind("click", function () {
var check = confirm("Entfernen?");
if (check)
$(this).parent().parent().remove();
});
p_counter++;
});
$(".remove-match-player").click(function () {
var check = confirm("Entfernen?");
if (check)
$(this).parent().parent().remove();
});
$(".report-form-submit-button").click(function () {
$(window).off('beforeunload');
var form = this.closest('form');
if (!form.checkValidity()) {
// Create the temporary button, click and remove it
const tmpSubmit = document.createElement('button');
form.appendChild(tmpSubmit);
tmpSubmit.click();
form.removeChild(tmpSubmit);
} else {
form.submit();
try {
$(this).dialog("close");
} catch (e) {
}
}
});
$(".refresh-player-list").click(function () {
$(window).unbind("beforeunload");
});
var p_counter = $(".countable").length;
$("#add-test-players").click(function () {
var remove = getRemove();
var type = $(this).attr("data-type");
var content = '' + '' + ' ' + ' ' + ' ' + '' + ' ' + ' ' + '' + ' ' + ' ';
if (type == "agility") {
content += ' ' + ' ';
} else if (type == "agility180") {
content += ' ';
} else if (type == "linear") {
content += ' ' + ' ' + ' ' + ' ';
} else if (type == "jump") {
content += ' ' + ' ' + ' ';
} else if (type == "shuttle") {
content = ' ' + '' + ' ' + ' ' + ' ' + '' + ' ' + ' ' + '' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + '' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + ' ' + '' + ' ' + '- ' + ' ' + ' ';
}
if (type != "shuttle") {
content += ' - ' + '';
}
$("#new-player-list").append(content);
$("#new-player-list").find("#player-autocomplete-" + p_counter).autocomplete({
serviceUrl: TraiwiJS.prototype.getUrl() + '/lookUpPlayers.do',
maxHeight: 500,
delimiter: " ",
autoSelectFirst: true,
showNoSuggestionNotice: false,
noSuggestionNotice: "Keinen Spieler gefunden",
formatResult: function (suggestion, currentValue) {
var utils = (function () {
return {
escapeRegExChars: function (value) {
return value.replace(
/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
},
createNode: function (html) {
var div = document.createElement('div');
div.innerHTML = html;
return div.firstChild;
}
};
}()),
keys = {
ESC: 27,
TAB: 9,
RETURN: 13,
LEFT: 37,
UP: 38,
RIGHT: 39,
DOWN: 40
};
var pattern = '(' + utils.escapeRegExChars(currentValue) + ')';
var imagesrc = suggestion.avatar;
if (!suggestion.avatar) {
imagesrc = "dfb/no-user.png";
}
return '' +
'' +
' ' +
' ' +
'' +
suggestion.value.replace(new RegExp(pattern, 'gi'), '$1 ') +
' ' + suggestion.team + ' ' +
' ';
},
onSelect: function (suggestion) {
$(this).prev().val(suggestion.data);
$(this).prev().attr("data-id", suggestion.data);
$(this).val(suggestion.value);
}
});
$(".remove-player").unbind("click");
$(".remove-player").bind("click", function () {
var check = confirm("Entfernen?");
if (check) {
if (type == "shuttle") {
$(this).parent().parent().prev().prev().remove();
$(this).parent().parent().prev().remove();
$(this).parent().parent().remove();
} else {
$(this).parent().parent().remove();
}
}
});
p_counter++;
});
var group_player_count = 0;
$("#add-additional-group-player").click(function () {
var players = getPlayers();
var content = '' + '' + ' ' + ' ' + ' ' + '' + 'x ' + ' ' + ' ';
$("#ajax-response").append(content);
$("#ajax-response").find("#player-autocomplete-" + group_player_count).autocomplete({
lookup: players, onSelect: function (suggestion) {
$(this).prev().val(suggestion.data);
}
});
$(".remove-group-player").unbind("click");
$(".remove-group-player").bind("click", function () {
var check = confirm("Entfernen?");
if (check)
$(this).parent().parent().remove();
});
group_player_count++;
});
$(".remove-group-player").click(function () {
var check = confirm("Entfernen?");
if (check)
$(this).parent().parent().remove();
});
var tourney_day_count = $(".tourney-days-countable").length;
$("#add-tourney-day").click(function () {
var date = getDate();
var starttime = getStarttime();
var endtime = getEndtime();
var firstmatch = getFirstmatch();
var matchdate = new Date();
var nextmatchdate = new Date();
nextmatchdate.setDate(matchdate.getDate() + tourney_day_count);
matchdate = nextmatchdate.toISOString().substring(0, 10);
nextmatchdate = nextmatchdate.toISOString().substring(0, 10);
var content = '' + '
' + '' + date + ' ' + ' ' + '
' + '
' + '' + starttime + ' ' + ' ' + '
' + '
' + '
' + firstmatch + ' ' + '
' + '
' + '
' + '
';
$("#tourney-days").append(content);
$(".remove-tourney-day").unbind("click");
$(".remove-tourney-day").bind("click", function () {
var check = confirm("Entfernen?");
if (check)
$(this).parent().parent().remove();
});
tourney_day_count++;
});
$(".remove-tourney-day").click(function () {
var check = confirm("Entfernen?");
if (check)
$(this).parent().parent().remove();
});
if (typeof getTeamPlayers == 'function') {
var team_player = getTeamPlayers();
}
$("#team-player-autocomplete").autocomplete({
lookup: team_player,
onSelect: function (suggestion) {
var status = $(".stuff-selected[name='player[" + suggestion.data + "]']");
if ($(status).val() == 1) {
var id = suggestion.data;
$(status).val(0);
$(status).parent().animate({
opacity: 1
}, 250);
$("#active-player-list").find(".teammate[data-id='" + suggestion.data + "']").remove();
} else {
$(status).val(1);
$(status).parent().animate({
opacity: 0.5
}, 250);
$(status).parent().clone().attr("data-id", suggestion.data).bind("click", function () {
disableTeamPlayer($("#active-player-list").find(".teammate[data-id='" + suggestion.data + "']"));
}).appendTo("#active-player-list .content-col");
$("#active-player-list").find(".teammatewrapper[data-id='" + suggestion.data + "'] .stuff-selected").attr("form", "teamform");
$("#active-player-list").find(".teammatewrapper[data-id='" + suggestion.data + "'] .evaluation-selected").attr("form", "teamform");
$("#active-player-list").find(".teammatewrapper[data-id='" + suggestion.data + "'] .status-footer-small").removeAttr("hidden");
$("#active-player-list").find(".teammatewrapper[data-id='" + suggestion.data + "'] .status-footer-small").removeClass("hidden");
$("#active-player-list .teammate").click(function () {
disablePlayer($(this).parent());
});
}
}
});
function disableTeamPlayer(item) {
var id = $(item).attr("data-player");
console.log(item);
var origin = $(".inactive-player-list").find(".teammate[data-player='" + id + "']");
$(origin).find("input").val(0);
$(origin).animate({opacity: 1}, 250);
$(item).remove();
}
$("#add-team-stuff").click(function () {
var stuff = getTeamStuff();
var roles = getStuffRoles();
var remove = getRemove();
var observer = getObserver();
var editor = getEditor();
var writepermission = getWritepermission();
var writepermission_short = getWritepermissionShort();
var p_counter = $(".active-stuff-list").last().data("key") + 1;
if (isNaN(p_counter)) {
p_counter = 0;
}
var content = '';
$("#stuff-list").append(content);
$("#stuff-list").find("#player-autocomplete-" + p_counter).autocomplete({
lookup: stuff, onSelect: function (suggestion) {
$(this).prev().val(suggestion.data);
}
});
$("#stuff-list").find("#player-role-autocomplete-" + p_counter).autocomplete({
lookup: roles, onSelect: function (suggestion) {
$(this).prev().val(suggestion.data);
}
});
$(".remove-stuff").unbind("click");
$(".remove-stuff").bind("click", function () {
var check = confirm("Entfernen?");
if (check) {
$(this).parent().remove();
}
});
});
$(".remove-stuff").click(function () {
var check = confirm("Entfernen?");
if (check) {
$(this).parent().remove();
}
});
$(".match-goal-player-selection").on("change", function () {
refreshGoals();
});
$(".match-owngoal").on("click", function () {
refreshGoals();
});
function refreshGoals() {
var outwards = $('#match-outwards').val();
var goals = $('.match-goal-countable');
var goalsFor = 0;
var goalsAgainst = 0;
goals.each(function () {
var counter = $(this).data("counter");
var player = $(this).find("#match-goal-" + counter + "-player");
var owngoal = $(this).find('#owngoal-' + counter);
if (player.val() == "") {
if (owngoal.is(":checked")) {
goalsFor++;
} else {
goalsAgainst++;
}
} else {
if (owngoal.is(":checked")) {
goalsAgainst++;
} else {
goalsFor++;
}
}
updateGoal(counter, $(this), outwards, goalsFor, goalsAgainst);
})
}
function updateGoal(counter, elem, outwards, goalsFor, goalsAgainst) {
if (outwards == 1) {
$('#match-goal-home-' + counter).html(goalsAgainst);
$('#match-goal-away-' + counter).html(goalsFor);
}
else {
$('#match-goal-home-' + counter).html(goalsFor);
$('#match-goal-away-' + counter).html(goalsAgainst);
}
}
var p_counter = $(".match-goal-countable").length;
$(".add-match-goal").click(function () {
var players = getPlayersForGoals(p_counter);
var assistplayers = getAssistPlayers(p_counter, "");
var assistplayers2 = getAssistPlayers(p_counter, "2");
var assistplayers3 = getAssistPlayers(p_counter, "3");
var remove = getRemove();
var opp = getOpp();
var team = getTeam();
var assist = getAssist();
var assist2 = getAssist2();
var assist3 = getAssist3();
var goaltypes = getGoalTypes(p_counter);
var assistgoaltypes = getAssistGoalTypes(p_counter);
var content =
'' +
'' +
' ' +
' ' +
'' +
' ' + ' : ' + ' ' +
' ' +
'' +
players +
' ' +
'' +
' ' + ' ' +
' ' +
goaltypes +
'' +
'x ' +
' ' +
' ' +
'' +
'' +
' ' + '' + assist + ' ' +
' ' + '' +
'' +
assistplayers +
' ' +
assistgoaltypes +
'' +
' ' + '' + assist2 + ' ' +
' ' + '' +
'' +
assistplayers2 +
' ' +
assistgoaltypes +
'' +
' ' + '' + assist3 + ' ' +
' ' + '' +
'' +
assistplayers3 +
' ' +
assistgoaltypes +
' ';
$("#goal-response").append(content);
refreshGoals();
$(".remove-match-goal").unbind("click");
$(".remove-match-goal").bind("click", function () {
var check = confirm("Entfernen?");
if (check) {
$(this).parent().parent().next().remove();
$(this).parent().parent().remove();
refreshGoals();
}
});
$(".match-goal-player-selection").unbind("change");
$(".match-goal-player-selection").bind("change", function () {
refreshGoals();
});
$(".match-owngoal").unbind();
$(".match-owngoal").bind("click", function () {
refreshGoals();
});
p_counter++;
});
$(".remove-match-goal").click(function () {
var check = confirm("Entfernen?");
if (check) {
$(this).parent().parent().next().remove();
$(this).parent().parent().remove();
refreshGoals();
}
});
$(".card-color").change(function () {
var pos = "0 0";
var val = $(this).val();
if (val == "yellow")
pos = "0 0"; else if (val == "red")
pos = "0 -26px"; else if (val == "yellowred")
pos = "0 -52px";
$(this).parent().next().find(".card-selected").css({backgroundPosition: pos});
});
var c_counter = $(".match-card-countable").length;
$(".add-match-card").click(function () {
var players = getCardPlayers(c_counter);
var remove = getRemove();
var yellow = getYellow();
var red = getRed();
var yellowred = getYellowred();
var team = getTeam();
var content = '' + '' + ' ' + ' ' + '' +
players + ' ' + ' ' + '' + '' + '' + yellow + ' ' + '' + red + ' ' + '' + yellowred + ' ' + ' ' + ' ' + '' + '
' + ' ' + '' + 'x ' + ' ' + ' ';
$("#card-response").append(content);
$(".remove-match-card").unbind("click");
$(".remove-match-card").bind("click", function () {
var check = confirm("Entfernen?");
if (check)
$(this).parent().parent().remove();
});
$(".card-color").unbind("change");
$(".card-color").bind("change", function () {
var pos = "0 0";
var val = $(this).val();
if (val == "yellow")
pos = "0 0"; else if (val == "red")
pos = "0 -26px"; else if (val == "yellowred")
pos = "0 -52px";
$(this).parent().next().find(".card-selected").css({backgroundPosition: pos});
});
c_counter++;
});
$(".remove-match-card").click(function () {
var check = confirm("Entfernen?");
if (check)
$(this).parent().parent().remove();
});
var i_counter = $(".match-injury-countable").length;
$(".add-match-injury").click(function () {
var players = getInjuryPlayers(i_counter);
var remove = getRemove();
var injuries = getInjuries(i_counter);
var opp = getOpp();
var team = getTeam();
var content = '' + '' + ' ' + ' ' + '' +
players + ' ' + '' +
injuries + ' ' + '' + 'x ' + ' ' + ' ';
$("#injury-response").append(content);
$(".remove-match-injury").unbind("click");
$(".remove-match-injury").bind("click", function () {
var check = confirm("Entfernen?");
if (check)
$(this).parent().parent().remove();
});
i_counter++;
});
$(".remove-match-injury").click(function () {
var check = confirm("Entfernen?");
if (check)
$(this).parent().parent().remove();
});
var e_counter;
var offstart = [];
var onstart = [];
var off = [];
var on = [];
var remove; // text
var opp; // text
var subin; // text
var subout; // text
var players;
var lastsubtime;
var mulitpleexchanges;
$(".add-match-exchange").click(function () {
var e_counter = $("input[name^=exchanges][name$='time]']").last().data("counter") + 1;
if (!e_counter) {
e_counter = 0;
}
var form = $("#report-form");
if (form[0].checkValidity()) {
} else {
$(' ').hide().appendTo(form).click().remove();
return false;
}
remove = getRemove(); // text
opp = getOpp(); // text
subin = getSubIn(); // text
subout = getSubOut(); // text
players = getMatchPlayersArray();
lastsubtime = 0;
mulitpleexchanges = getMultipleExchanges();
var last_counter = e_counter - 1;
onstart = getPlayersOnFromField();
offstart = getPlayersOffFromBench();
on = onstart;
off = offstart;
calculateSubs(e_counter);
lastsubtime = $('input[name="exchanges[' + last_counter + '][time]"]').val();
if (!lastsubtime || lastsubtime < 1) {
lastsubtime = 0;
}
var content = '' +
'' +
' '
+ ' ' +
'' + getOptionsFromArray(on, e_counter, "out") + ' ' +
'' + getOptionsFromArray(off, e_counter, "in") + ' ' +
'' + ' x ' + ' ' +
' ';
$("#exchange-response").append(content);
$(".remove-match-exchange").unbind("click");
$(".remove-match-exchange").bind("click", function () {
var check = confirm("Entfernen?");
if (check) {
$(this).parent().parent().remove();
}
});
});
function getPlayersOnFromField() {
var players = [];
$("#soccerfield").find(".start-player-wrapper").each(function () {
var id = $(this).data("id");
var name = getPlayerById(id)["lastname"] + " , " + getPlayerById(id)["firstname"];
var player = {id: id, name: name};
players.push(player);
});
players = players.sort();
return players;
}
function getPlayersOffFromBench() {
var players = [];
$("#matchsquad-wrapper").find("ul.squadplayers .drag-player").each(function () {
var id = $(this).data("id");
var name = getPlayerById(id)["lastname"] + " , " + getPlayerById(id)["firstname"];
var player = {id: id, name: name};
players.push(player);
});
players = players.sort();
return players;
}
function getOptionsFromArray(players, player_counter, inout) {
var onField = "Spielfeld";
if (inout == "in") {
onField = "Bank";
}
var content = ' ' +
'' + opp +
' ' +
' ';
players.forEach(function (player) {
var id = player.id;
var name = player.name;
var status = player.status;
if (id) {
content += '' +
name +
' ';
}
});
content += ' ';
return content;
}
function addPlayersToArray(players, array) {
players.forEach(function (player) {
array = addPlayerToArray(player, array);
});
return array;
}
function removePlayersFromArray(players, array) {
players.forEach(function (player) {
array = removePlayerFromArray(player, array);
});
return array;
}
function addPlayerToArray(addplayer, array) {
var playerExists = false;
array.forEach(function (player) {
var id = player.id;
var addId = addplayer.id;
if (addId == id) {
playerExists = true;
}
});
if (!playerExists) {
array.push(addplayer);
array = array.sort();
}
return array;
}
function removePlayerFromArray(removeplayer, array) {
var newarray = [];
array.forEach(function (player) {
var id = player.id;
var removeid = removeplayer.id;
if (id != removeid) {
newarray.push(player);
}
});
return newarray;
}
function getSubsIn(player_counter) {
var counter;
var subsin = [];
for (counter = 0; counter < player_counter; counter++) {
var id = $('select[name="exchanges[' + counter + '][in]"]').find("option:selected").val();
var name = $('select[name="exchanges[' + counter + '][in]"]').find("option:selected").html();
var player = {
id: id,
name: name,
status: "ok"
};
subsin.push(player);
}
return subsin;
}
function getSubsOut(player_counter) {
var counter;
var subsout = [];
for (counter = 0; counter < player_counter; counter++) {
var id = $('select[name="exchanges[' + counter + '][out]"]').find("option:selected").val();
var name = $('select[name="exchanges[' + counter + '][out]"]').find("option:selected").html();
var player = {
id: id,
name: name,
status: "ok"
};
subsout.push(player);
}
return subsout;
}
function calculateSubs(player_counter) {
var counter;
for (counter = 0; counter < player_counter; counter++) {
var id = $('select[name="exchanges[' + counter + '][out]"]').find("option:selected").val();
var name = $('select[name="exchanges[' + counter + '][out]"]').find("option:selected").html();
var player = {
id: id,
name: name,
status: "ok"
};
on = removePlayerFromArray(player, on);
if (mulitpleexchanges) {
off = addPlayerToArray(player, off);
} else {
off = removePlayerFromArray(player, off);
}
var id = $('select[name="exchanges[' + counter + '][in]"]').find("option:selected").val();
var name = $('select[name="exchanges[' + counter + '][in]"]').find("option:selected").html();
var player = {
id: id,
name: name,
status: "ok"
};
off = removePlayerFromArray(player, off);
on = addPlayerToArray(player, on);
}
}
$(".remove-match-exchange").click(function () {
var check = confirm("Entfernen?");
if (check) {
$(this).parent().parent().remove();
}
});
$(".remove-match-exchanges").click(function () {
var exchangebody = $('#exchange-response');
var check = confirm("Wollen Sie wirklich alle Entfernen?");
if (check) {
exchangebody.children().each(function () {
$(this).remove();
});
}
});
$("#add-new-injury").click(function () {
$("#new-injury-dialog").dialog("open");
});
$("#new-injury-dialog").dialog({
height: "auto",
width: $(window).width() > 600 ? 600 : $(window).width(),
modal: true,
position: ["center", "center"],
autoOpen: false,
show: 'fade',
hide: 'fade',
buttons: {
"Schließen": function () {
$(this).dialog("close");
}, "Speichern": function () {
$(this).dialog("close");
$("#injury-form").submit();
}
},
create: function () {
$(this).closest(".ui-dialog").find("button:first").addClass("btn float-left");
$(this).closest(".ui-dialog").find("button:last").addClass("btn btn-info");
}
});
$(window).resize(function () {
if ($(window).width() < 600) {
$("#new-injury-dialog").dialog("option", "width", $(window).width());
} else {
$("#new-injury-dialog").dialog("option", "width", 600);
}
});
$(".remove-therapy").bind("click", function () {
var check = confirm("Entfernen?");
if (check)
$(this).parent().parent().parent().parent().remove();
});
var t_counter = $(".therapy").length;
$("#add-therapy").click(function () {
var nt = getNewTherapy(t_counter);
$("#therapies").append(nt);
$(".remove-therapy").unbind("click");
$(".remove-therapy").bind("click", function () {
var check = confirm("Entfernen?");
if (check)
$(this).parent().parent().parent().parent().remove();
});
t_counter++;
});
$(".show-therapy").click(function () {
var id = $(this).attr("data-id");
var parent = $(this).parent().parent();
if ($("#therapy-" + id).length == 0) {
$("#ajax-loading").dialog("open");
var url = getUrl();
var is_method = url.substring(url.lastIndexOf('/') + 1);
if (is_method.substr(-3, 3) == ".do")
url = url.substr(0, url.length - is_method.length);
$.post(url + "/showTherapy.do", {id: id}, function (data) {
$("#ajax-loading").dialog("close");
$(parent).after(data);
$(parent).slideDown("slow");
});
} else {
$("#therapy-" + id).slideUp("slow").remove();
}
});
$("#new-anamnese-dialog").dialog({
height: "auto",
width: $(window).width() > 600 ? 600 : $(window).width(),
modal: true,
position: ["center", "center"],
autoOpen: false,
title: "Anamnese",
show: 'fade',
hide: 'fade',
buttons: {
"Schließen": function () {
$(this).dialog("close");
}, "Speichern": function () {
$(this).dialog("close");
$("#anamnese-form").submit();
}
},
create: function () {
$(this).closest(".ui-dialog").find("button:first").addClass("btn float-left");
$(this).closest(".ui-dialog").find("button:last").addClass("btn btn-info");
}
});
$("#add-new-anamnese").click(function () {
$("#new-anamnese-dialog").dialog("open");
});
$("#new-allergy-dialog").dialog({
height: "auto",
width: $(window).width() > 600 ? 600 : $(window).width(),
modal: true,
position: ["center", "center"],
autoOpen: false,
title: "Allergie",
show: 'fade',
hide: 'fade',
buttons: {
"Schließen": function () {
$(this).dialog("close");
}, "Speichern": function () {
$(this).dialog("close");
$("#allergy-form").submit();
}
},
create: function () {
$(this).closest(".ui-dialog").find("button:first").addClass("btn float-left");
$(this).closest(".ui-dialog").find("button:last").addClass("btn btn-info");
}
});
$("#add-new-allergy").click(function () {
$("#new-allergy-dialog").dialog("open");
});
$("#new-education-dialog").dialog({
height: "auto",
width: $(window).width() > 263 ? 263 : $(window).width(),
modal: true,
position: ["center", "center"],
autoOpen: false,
show: 'fade',
hide: 'fade',
title: "Schulung",
buttons: {
"Schließen": function () {
$(this).dialog("close");
}, "Speichern": function () {
$(this).dialog("close");
$("#education-form").submit();
}
},
create: function () {
$(this).closest(".ui-dialog").find("button:first").addClass("btn float-left");
$(this).closest(".ui-dialog").find("button:last").addClass("btn btn-info");
}
});
$("#add-new-education").click(function () {
$("#new-education-dialog").dialog("open");
});
$("#new-history-dialog").dialog({
height: "auto",
width: $(window).width() > 263 ? 263 : $(window).width(),
modal: true,
position: ["center", "center"],
autoOpen: false,
show: 'fade',
hide: 'fade',
title: "Historie",
buttons: {
"Schließen": function () {
$(this).dialog("close");
}, "Speichern": function () {
$(this).dialog("close");
$("#history-form").submit();
}
},
create: function () {
$(this).closest(".ui-dialog").find("button:first").addClass("btn float-left");
$(this).closest(".ui-dialog").find("button:last").addClass("btn btn-info");
}
});
$("#add-new-history").click(function () {
$("#new-history-dialog").dialog("open");
});
$("#new-body-size-dialog").dialog({
height: "auto",
width: $(window).width() > 263 ? 263 : $(window).width(),
modal: true,
position: ["center", "center"],
autoOpen: false,
show: 'fade',
hide: 'fade',
title: "Körpermaße",
buttons: {
"Schließen": function () {
$(this).dialog("close");
}, "Speichern": function () {
$(this).dialog("close");
$("#body-size-form").submit();
}
},
create: function () {
$(this).closest(".ui-dialog").find("button:first").addClass("btn float-left");
$(this).closest(".ui-dialog").find("button:last").addClass("btn btn-info");
}
});
$("#add-new-body-size").click(function () {
$("#new-body-size-dialog").dialog("open");
new TraiwiJS.Datepicker("create-time");
new TraiwiJS.Datepicker("create-time-2le");
});
$("#new-note-dialog").dialog({
height: "auto",
width: $(window).width() > 400 ? 400 : $(window).width(),
modal: true,
position: ["center", "center"],
autoOpen: false,
show: 'fade',
hide: 'fade',
title: "Notiz",
buttons: {
"Schließen": function () {
$(this).dialog("close");
}, "Speichern": function () {
$(this).dialog("close");
$("#note-form").submit();
}
},
create: function () {
$(this).closest(".ui-dialog").find("button:first").addClass("btn float-left");
$(this).closest(".ui-dialog").find("button:last").addClass("btn btn-info");
}
});
$("#add-new-note").click(function () {
$("#new-note-dialog").dialog("open");
});
$(".rotate").click(function () {
rotateItem($(this));
});
function rotateItem(item) {
var orientation = $(item).attr("data-orientation");
var input = $(item).parent().find("input.orientation");
if (orientation == "right") {
$(item).attr("data-orientation", "bottom");
$(item).parent().parent().removeClass("right");
$(item).parent().parent().addClass("bottom");
if ($(input).length > 0)
$(input).val("bottom");
} else if (orientation == "top") {
$(item).attr("data-orientation", "right");
$(item).parent().parent().removeClass("top");
$(item).parent().parent().addClass("right");
if ($(input).length > 0)
$(input).val("right");
} else if (orientation == "left") {
$(item).attr("data-orientation", "top");
$(item).parent().parent().removeClass("left");
$(item).parent().parent().addClass("top");
if ($(input).length > 0)
$(input).val("top");
} else if (orientation == "bottom") {
$(item).attr("data-orientation", "left");
$(item).parent().parent().removeClass("bottom");
$(item).parent().parent().addClass("left");
if ($(input).length > 0)
$(input).val("left");
}
}
var ic = $(".drag-injury").length;
var $front = $("#human-front");
var $back = $("#human-back");
$(".remove-item").bind("click", function () {
$(this).parent().parent().remove();
});
$(".drag-injury").draggable({
containment: "document", cursor: "move", stop: function (event, ui) {
setInjuryOffset(this);
}
});
$("#add-new-front-item").click(function () {
var findingid = $("#items-front").val();
var findingtext = $("#items-front option:selected").html();
var findingcat = $("#items-front option:selected").attr("data-cat");
var item = '' + '
' + 'X ' + ' ' +
findingtext + (findingcat != "" ? " (" + findingcat + ")" : "") + ' ' + ' ' + ' ' + ' ' + ' ' + '
' + '
';
$(item).appendTo($front);
$(".drag-injury").draggable({
containment: "document", cursor: "move", stop: function (event, ui) {
setInjuryOffset(this);
}
});
$(".remove-item").unbind("click");
$(".remove-item").bind("click", function () {
$(this).parent().parent().remove();
});
$(".rotate").unbind("click");
$(".rotate").bind("click", function () {
rotateItem($(this));
});
ic++;
});
$("#add-new-back-item").click(function () {
var findingid = $("#items-back").val();
var findingtext = $("#items-back option:selected").html();
var findingcat = $("#items-back option:selected").attr("data-cat");
var item = '' + '
' + 'X ' + ' ' +
findingtext + (findingcat != "" ? " (" + findingcat + ")" : "") + ' ' + ' ' + ' ' + ' ' + ' ' + '
' + '
';
$(item).appendTo($back);
$(".drag-injury").draggable({
containment: "document", cursor: "move", stop: function (event, ui) {
setInjuryOffset(this);
}
});
$(".remove-item").unbind("click");
$(".remove-item").bind("click", function () {
$(this).parent().parent().remove();
});
$(".rotate").unbind("click");
$(".rotate").bind("click", function () {
rotateItem($(this));
});
ic++;
});
function setInjuryOffset(item) {
var id = $(item).attr("data-id");
var inputx = $(item).find('input[name="items[' + id + '][x]"]');
var inputy = $(item).find('input[name="items[' + id + '][y]"]');
$(inputx).val($(item).position().left);
$(inputy).val($(item).position().top);
}
$("#docu-sort tbody").sortable({
stop: function () {
var trainingsdocu = "";
var spacer = "";
$("input[name^=docu_id]").each(function (c, v) {
trainingsdocu += spacer + $(v).val();
spacer = ";";
});
var url = getUrl();
var is_method = url.substring(url.lastIndexOf('/') + 1);
if (is_method.substr(-3, 3) == ".do")
url = url.substr(0, url.length - is_method.length);
$.post(url + "/showAjax.do", {docusort: trainingsdocu}, function (data) {
$("#ajax-response").empty();
$("#ajax-response").append(data);
$(".info-button").unbind("click");
$(".info-button").bind("click", function () {
getExercise($(this));
});
})
}
});
$("#exercise-dialog").dialog({
height: "auto",
width: $(window).width() > 800 ? 800 : $(window).width(),
modal: true,
title: "Übung",
show: 'fade',
hide: 'fade',
position: ["center", "center"],
autoOpen: false,
buttons: {
"Schließen": function () {
$(this).dialog("close");
}
},
create: function () {
$(this).closest(".ui-dialog").find("button:first").addClass("btn");
}
});
$(".info-button").click(function () {
getExercise($(this));
});
$(".exercises-button").click(function () {
getExercises($(this));
});
function getExercise(item) {
$("#ajax-loading").dialog("open");
var id = $(item).attr("data-id");
var url = getUrl();
var is_method = url.substring(url.lastIndexOf('/') + 1);
if (is_method.substr(-3, 3) == ".do")
url = url.substr(0, url.length - is_method.length);
$.post(url + "/getExercise.do", {id: id}, function (data) {
$("#ajax-loading").dialog("close");
$("#exercise-dialog").empty();
$("#exercise-dialog").append(data);
$("#exercise-dialog").dialog("open");
$("#exercise-dialog").find("img").bind("click", function () {
showFbImage(this);
});
});
}
function getExercises(item) {
$("#ajax-loading").dialog("open");
var id = $(item).attr("data-id");
var url = getUrl();
var is_method = url.substring(url.lastIndexOf('/') + 1);
if (is_method.substr(-3, 3) == ".do")
url = url.substr(0, url.length - is_method.length);
$.post(url + "/getExercises.do", {id: id}, function (data) {
$("#ajax-loading").dialog("close");
$("#exercise-dialog").empty();
$("#exercise-dialog").append(data);
$(".slider").css({display: "none"});
$(".slider.active").css({display: "block", width: "100%"});
$(".next-exercise").unbind("click");
$(".next-exercise").bind("click", function () {
getNextExercise($(this));
});
$(".prev-exercise").unbind("click");
$(".prev-exercise").bind("click", function () {
getPrevExercise($(this));
});
$("#exercise-dialog").dialog("open");
$("#exercise-dialog").find("img").bind("click", function () {
showFbImage(this);
});
});
}
function getNextExercise(item) {
var $parent = $(item).closest(".slider");
if ($parent.next().length > 0) {
$parent.css({display: "none", width: "hide"});
$parent.removeClass("active");
$parent.next().addClass("active");
$parent.next().css({display: "block", width: "100%"});
}
}
function getPrevExercise(item) {
var $parent = $(item).closest(".slider");
if ($parent.prev().length > 0) {
$parent.css({display: "none", width: "hide"});
$parent.removeClass("active");
$parent.prev().addClass("active");
$parent.prev().css({display: "block", width: "100%"});
}
}
$("#fbdocu-submit").click(function () {
var images = $("input[name*='images']");
$.each(images, function (k, v) {
$('#fbdocu-form').append($(v));
})
var videos = $("input[name*='videos']");
$.each(videos, function (k, v) {
$('#fbdocu-form').append($(v));
});
var pdfs = $("input[name*='pdfs']");
$.each(pdfs, function (k, v) {
$('#fbdocu-form').append($(v));
});
$("#fbdocu-form").submit();
});
$(".template-exercise-select").change(function () {
$("#ajax-loading").dialog("open");
var type = $("#type").val();
var technic = $("#technic").val();
var tactic = $("#tactic").val();
var form = $("#form").val();
var age = $("#age").val();
var playersmin = $("#playersmin").val();
var playersmax = $("#playersmax").val();
var phase = $("#phase").val();
var field = $("#field").val();
var intensity = $("#intensity").val();
var duration = $("#duration").val();
var sportmotoric = $("#sportmotoric").val();
var trainer = $("#trainer").val();
var url = getUrl();
var is_method = url.substring(url.lastIndexOf('/') + 1);
if (is_method.substr(-3, 3) == ".do")
url = url.substr(0, url.length - is_method.length);
$.post(url + "/showTemplateAjax.do", {
type: type,
technic: technic,
tactic: tactic,
form: form,
age: age,
playersmin: playersmin,
playersmax: playersmax,
phase: phase,
field: field,
intensity: intensity,
duration: duration,
sportmotoric: sportmotoric,
trainer: trainer
}, function (data) {
$("#ajax-response").empty();
$("#ajax-response").append(data);
$("#ajax-loading").dialog("close");
$("#ajax-response").find(".info-button").bind("click", function () {
getExercise($(this));
});
});
});
$(".additional-template").each(function () {
$(this).removeClass("hidden");
})
$("#contact-stuff-dialog, #contact-team-dialog").dialog({
height: "auto",
width: $(window).width() > 550 ? 550 : $(window).width(),
modal: true,
title: "Kontakt",
show: 'fade',
hide: 'fade',
position: ["center", "center"],
autoOpen: false,
buttons: {
"Schließen": function () {
$(this).dialog("close");
}, "Senden": function () {
$(this).dialog("close");
$(this).find("form").submit();
}
},
create: function () {
$(this).closest(".ui-dialog").find("button:first").addClass("btn float-left");
$(this).closest(".ui-dialog").find("button:last").addClass("btn btn-info");
}
});
$("#contact-stuff-button").click(function () {
$("#contact-stuff-dialog").dialog("open");
});
$("#contact-team-button").click(function () {
$("#contact-team-dialog").dialog("open");
});
$("#transfer-opps").click(function () {
var action = $(this).prev().val();
var url = getUrl();
var is_method = url.substring(url.lastIndexOf('/') + 1);
if (is_method.substr(-3, 3) == ".do")
url = url.substr(0, url.length - is_method.length);
if (url.substr(0, 1) == "/")
url = url.substr(1);
$("#opp-form").attr("action", url + "/" + action);
});
$(".show-match-calendar").click(function () {
$("#ajax-loading").dialog("open");
var saison = $(this).attr("data-saison");
var url = getUrl();
var is_method = url.substring(url.lastIndexOf('/') + 1);
if (is_method.substr(-3, 3) == ".do")
url = url.substr(0, url.length - is_method.length);
$.post(url + "/getCalendarPdf.do", {calendar_saison: saison}, function (data) {
$("#ajax-loading").dialog("close");
if (data == "false") {
alert('PDF konnte nicht erstellt werden');
} else {
if ($.browser.device == true) {
window.open(data, "_self");
} else {
var win_popup = window.open(data, "_blank");
if (!win_popup) {
alert("Popups sind in Ihrem Browser blockiert");
}
}
}
});
});
var focus_counter = $(".focus-countable").length;
$(".remove-focus").bind("click", function () {
removeFocus(this);
});
$("#add-focus").click(function () {
var focuses = getFocuses(focus_counter);
$("#focus-response").append(focuses);
$(".remove-focus").unbind("click");
$(".remove-focus").bind("click", function () {
removeFocus(this);
});
focus_counter++;
});
function removeFocus(item) {
var check = confirm("Entfernen?");
if (check)
$(item).parent().remove();
}
$("#scout-order-dialog").dialog({
height: "auto",
width: $(window).width() > 800 ? 800 : $(window).width(),
modal: true,
title: "Auftrag",
show: 'fade',
hide: 'fade',
position: ["center", "center"],
autoOpen: false,
buttons: {
"Schließen": function () {
$(this).dialog("close");
}, "Senden": function () {
var form = document.getElementById("scout-order-form");
if (!form.checkValidity()) {
// Create the temporary button, click and remove it
const tmpSubmit = document.createElement('button');
form.appendChild(tmpSubmit);
tmpSubmit.click();
form.removeChild(tmpSubmit);
} else {
$("#scout-order-form").submit();
$(this).dialog("close");
}
}
},
create: function () {
$(this).closest(".ui-dialog").find("button:first").addClass("btn float-left");
$(this).closest(".ui-dialog").find("button:last").addClass("btn btn-info");
}
});
$("#scout-order-button").click(function () {
$("#scout-order-dialog").dialog("open");
});
$("#add-additional-email").click(function () {
var input = ' ';
$("#additional-emails").append(input);
});
$("#add-additional-phone").click(function () {
var input = ' ';
$("#additional-phones").append(input);
});
$("#add-additional-mobile").click(function () {
var input = ' ';
$("#additional-mobiles").append(input);
});
var calendar_user_counter = $(".countable").length;
$("#add-person").click(function () {
var players = getPlayers();
var content = '' + '' + ' ' + ' ' + ' ' + ' ' + ' ' + 'x ' + ' ';
$("#ajax-response").prepend(content);
$("#ajax-response").find("#user-autocomplete-" + calendar_user_counter).autocomplete({
lookup: players, onSelect: function (suggestion) {
$(this).prev().val(suggestion.data);
}
});
$(".remove-user").unbind("click");
$(".remove-user").bind("click", function () {
var check = confirm("Entfernen?");
if (check)
$(this).parent().parent().remove();
});
calendar_user_counter++;
});
$(".remove-user").click(function () {
var check = confirm("Entfernen?");
if (check)
$(this).parent().parent().remove();
});
$("#remove-all").bind("click", function () {
var check = confirm("Entfernen?");
if (check) {
$(".countable").each(function (k, v) {
$(v).remove();
});
}
});
var calendar_principal_counter = $(".countable").length;
$("#add-principal").click(function () {
var players = getPlayers();
var content = '';
$("#ajax-response").append(content);
$("#ajax-response").find("#principal-autocomplete-" + calendar_principal_counter).autocomplete({
lookup: players, onSelect: function (suggestion) {
$(this).prev().val(suggestion.data);
}
});
$(".remove-principal").unbind("click");
$(".remove-principal").bind("click", function () {
var check = confirm("Entfernen?");
if (check)
$(this).parent().remove();
});
calendar_user_counter++;
});
$(".remove-principal").click(function () {
var check = confirm("Entfernen?");
if (check)
$(this).parent().remove();
});
$(".gameplan-input").mouseover(function () {
$(this).css({"height": "100px", "word-break": "break-word"});
}).mouseout(function () {
$(this).css({"height": "20px", "word-break": "inherit"});
});
});
function removeDocument(item) {
var check = confirm("Entfernen?");
if (check) {
$("#ajax-loading").dialog("open");
var parent = $(item).parent().parent();
var id = $(item).attr("data-id");
var url = getUrl();
var is_method = url.substring(url.lastIndexOf('/') + 1);
if (is_method.substr(-3, 3) == ".do")
url = url.substr(0, url.length - is_method.length);
$.post(url + "/removeDocument.do", {id: id}, function () {
$("#ajax-loading").dialog("close");
$(parent).remove();
});
}
}
function removeTmpItem(item) {
var check = confirm("Entfernen?");
if (check) {
$("#ajax-loading").dialog("open");
var parent = $(item).parent();
var document = $(item).prev().val();
var url = getUrl();
var is_method = url.substring(url.lastIndexOf('/') + 1);
if (is_method.substr(-3, 3) == ".do")
url = url.substr(0, url.length - is_method.length);
$.post(url + "/removeTmpItem.do", {document: document}, function () {
$("#ajax-loading").dialog("close");
$(parent).remove();
});
}
}
function removeCompleteItem(item) {
var check = confirm("Entfernen?");
if (check) {
var parent = $(item).parent();
$(parent).remove();
}
}
function validate(formData, jqForm, options) {
var ignore = $(jqForm).find("input[name='ignore_size']");
if ($(ignore).length == 0) {
if (formData.length > 0) {
var size = formData[0].value.size / 1024;
if (size > 4000) {
alert('Die Datei ist zu groß');
return false;
}
if (!formData[0].value) {
alert('Es muss eine Datei ausgewählt werden');
return false;
}
}
}
}
function addOption(target) {
var rqid = $(target).data("id");
var content =
'' +
'
' +
' ' +
'
' +
'
' +
'
' +
'
' +
'
';
$(target).parent().parent().append(content);
$(".report-remove-option").bind("click", function () {
$(this).parent().parent().remove();
});
}
function addCategory(target) {
var label = getCategoryLabel();
var question = getQuestionButton();
var placeholder = getCategoryPlaceholder();
var remove = getRemove();
var cat = getCategories();
var c = $(".report-category").length + 1;
var content =
'' +
'
' +
'
' +
'
' +
'
' +
'
' +
' ' +
' ' +
'' + label + ' ' +
' ' +
cat +
'
' +
'
' +
'Noten ' +
' ' +
'
' +
'
' +
'
' +
'
' +
'
' +
'
' +
'
' +
'
';
$("#origin").append(content);
$(".remove-report-category").bind("click", function () {
$(this).parent().parent().parent().parent().remove();
});
$(".add-report-question").bind("click", function () {
var q = $(".singleq").length;
addQuestion($(this), String($(this).data("category")), q + 1);
});
$(".add-report-question-before").bind("click", function () {
var q = $(".singleq").length;
addQuestion($(this), String($(this).data("category")), q + 1);
});
$(".report-categories").bind("change", function () {
var text = $(this).find(":selected").text();
if (text == '---')
text = "";
$(this).prev().val(text);
});
}
function addQuestion(target, category, id) {
var label = getQuestionLabel();
var placeholder = getQuestionPlaceholder();
var remove = getRemove();
var questions = getQuestions();
var input1 = getQuestionInput1();
var input2 = getQuestionInput2();
var input3 = getQuestionInput3();
var range1 = getQuestionRange1();
var range2 = getQuestionRange2();
var range3 = getQuestionRange3();
var range4 = getQuestionRange4();
var grade = getQuestionGrade();
var select = getQuestionSelect();
var rangeplaceholder = getQuestionRangePlaceholder();
var content =
'' +
'
' +
'
' +
' ' +
' ' +
' ' +
' ' +
'' +
'' + range1 + ' ' +
'' + range2 + ' ' +
'' + range3 + ' ' +
'' + range4 + ' ' +
'' + grade + ' ' +
'' + input1 + ' ' +
'' + input2 + ' ' +
'' + input3 + ' ' +
'' + select + ' ' +
' ' +
'
' +
'
' +
'
' +
'
' +
'
' +
'
' +
'
' +
'
' +
'
' +
'
' +
' ' +
questions +
'
' +
'
' +
'
' +
'
' +
'
' +
'
' +
'
' +
'
' +
'
' +
'
' +
'
';
if (target == "origin") {
$("#origin").append(content);
}
else {
$('#report-category-sortable-' + category).append(content);
}
var rqid = 'new-q-' + id;
var type = "range1";
var url = getUrl();
var is_method = url.substring(url.lastIndexOf('/') + 1);
if (is_method.substr(-3, 3) == ".do") {
url = url.substr(0, url.length - is_method.length);
}
$("#question-config-" + rqid).load(url + "getQuestionConfigAjax.do", {"id": rqid, "type": type});
$(".remove-report-question").click(function () {
$(this).parent().parent().parent().remove();
});
$(".report-questions").bind("change", function () {
var text = $(this).find(":selected").text();
if (text == '---')
text = "";
$(this).prev().val(text);
});
}
$(document).ready(function () {
var $drag_players_f1 = $("#drag-players-field1");
var $soccerfield_f1 = $("#soccerfield-field1");
$(".drag-player-scouting", $drag_players_f1).draggable({
containment: "document", cursor: "move", helper: "clone", stop: function (event, ui) {
setOffsetF1(this, $soccerfield_f1);
}
});
$(".drag-player-scouting", $soccerfield_f1).draggable({
containment: "document", cursor: "move", stop: function (event, ui) {
setOffsetF1(this, $soccerfield_f1);
}
});
$soccerfield_f1.droppable({
accept: "#drag-players-field1 > .drag-player-scouting", drop: function (event, ui) {
placeOnFieldF1(ui.draggable, ui.offset, ui.position, event);
}
});
$drag_players_f1.droppable({
accept: "#soccerfield-field1 > .drag-player-scouting", drop: function (event, ui) {
placeOnBankF1(ui.draggable);
}, hoverClass: "hover"
});
function placeOnFieldF1($item, $offset, $position, e) {
var id = $item.attr("data-id");
var name = ' ';
$item.find("div[class*='name']").empty().append(name);
var valx = parseInt(e.pageX - $soccerfield_f1.offset().left - 5);
var valy = parseInt(e.pageY - $soccerfield_f1.offset().top - 14);
$item.css({top: valy, left: valx, position: "absolute"});
var inputx = ' ';
var inputy = ' ';
$soccerfield_f1.append(inputx);
$soccerfield_f1.append(inputy);
$item.appendTo($soccerfield_f1);
$item.draggable("option", "helper", "original");
return false;
}
function placeOnBankF1($item) {
var id = $item.attr("data-id");
$item.find("div[class*='name']").empty();
var inputx = $soccerfield_f1.find('input[name="field1[' + id + '][x]"]');
var inputy = $soccerfield_f1.find('input[name="field1[' + id + '][y]"]');
var inputid = $soccerfield_f1.find('input[name="field1[' + id + '][id]"]');
$(inputx).remove();
$(inputy).remove();
if (inputid != null)
$(inputid).remove();
$item.css({left: 0, top: 0, position: "inherit"});
$item.appendTo($drag_players_f1);
$item.draggable("option", "helper", "clone");
return false;
}
function setOffsetF1(player, field) {
var id = $(player).attr("data-id");
var $pdiv = $(field).find('div[data-id="' + id + '"]');
var inputx = $(field).find('input[name="field1[' + id + '][x]"]');
var inputy = $(field).find('input[name="field1[' + id + '][y]"]');
$(inputx).val($(player).position().left);
$(inputy).val($(player).position().top);
}
var $drag_players_f2 = $("#drag-players-field2");
var $soccerfield_f2 = $("#soccerfield-field2");
$(".drag-player-scouting", $drag_players_f2).draggable({
containment: "document", cursor: "move", helper: "clone", stop: function (event, ui) {
setOffsetF2(this, $soccerfield_f2);
}
});
$(".drag-player-scouting", $soccerfield_f2).draggable({
containment: "document", cursor: "move", stop: function (event, ui) {
setOffsetF2(this, $soccerfield_f2);
}
});
$soccerfield_f2.droppable({
accept: "#drag-players-field2 > .drag-player-scouting", drop: function (event, ui) {
placeOnFieldF2(ui.draggable, ui.offset, ui.position, event);
}
});
$drag_players_f2.droppable({
accept: "#soccerfield-field2 > .drag-player-scouting", drop: function (event, ui) {
placeOnBankF2(ui.draggable);
}, hoverClass: "hover"
});
function placeOnFieldF2($item, $offset, $position, e) {
var id = $item.attr("data-id");
var name = ' ';
$item.find("div[class*='name']").empty().append(name);
var valx = parseInt(e.pageX - $soccerfield_f2.offset().left - 5);
var valy = parseInt(e.pageY - $soccerfield_f2.offset().top - 14);
$item.css({top: valy, left: valx, position: "absolute"});
var inputx = ' ';
var inputy = ' ';
$soccerfield_f2.append(inputx);
$soccerfield_f2.append(inputy);
$item.appendTo($soccerfield_f2);
$item.draggable("option", "helper", "original");
return false;
}
function placeOnBankF2($item) {
var id = $item.attr("data-id");
$item.find("div[class*='name']").empty();
var inputx = $soccerfield_f2.find('input[name="field2[' + id + '][x]"]');
var inputy = $soccerfield_f2.find('input[name="field2[' + id + '][y]"]');
var inputid = $soccerfield_f2.find('input[name="field2[' + id + '][id]"]');
$(inputx).remove();
$(inputy).remove();
if (inputid != null)
$(inputid).remove();
$item.css({left: 0, top: 0, position: "inherit"});
$item.appendTo($drag_players_f2);
$item.draggable("option", "helper", "clone");
return false;
}
function setOffsetF2(player, field) {
var id = $(player).attr("data-id");
var $pdiv = $(field).find('div[data-id="' + id + '"]');
var inputx = $(field).find('input[name="field2[' + id + '][x]"]');
var inputy = $(field).find('input[name="field2[' + id + '][y]"]');
$(inputx).val($(player).position().left);
$(inputy).val($(player).position().top);
}
var $drag_players_f3 = $("#drag-players-field3");
var $soccerfield_f3 = $("#soccerfield-field3");
$(".drag-player-scouting", $drag_players_f3).draggable({
containment: "document", cursor: "move", helper: "clone", stop: function (event, ui) {
setOffsetF3(this, $soccerfield_f3);
}
});
$(".drag-player-scouting", $soccerfield_f3).draggable({
containment: "document", cursor: "move", stop: function (event, ui) {
setOffsetF3(this, $soccerfield_f3);
}
});
$soccerfield_f3.droppable({
accept: "#drag-players-field3 > .drag-player-scouting", drop: function (event, ui) {
placeOnFieldF3(ui.draggable, ui.offset, ui.position, event);
}
});
$drag_players_f3.droppable({
accept: "#soccerfield-field3 > .drag-player-scouting", drop: function (event, ui) {
placeOnBankF3(ui.draggable);
}, hoverClass: "hover"
});
function placeOnFieldF3($item, $offset, $position, e) {
var id = $item.attr("data-id");
var name = ' ';
$item.find("div[class*='name']").empty().append(name);
var valx = parseInt(e.pageX - $soccerfield_f3.offset().left - 5);
var valy = parseInt(e.pageY - $soccerfield_f3.offset().top - 14);
$item.css({top: valy, left: valx, position: "absolute"});
var inputx = ' ';
var inputy = ' ';
$soccerfield_f3.append(inputx);
$soccerfield_f3.append(inputy);
$item.appendTo($soccerfield_f3);
$item.draggable("option", "helper", "original");
return false;
}
function placeOnBankF3($item) {
var id = $item.attr("data-id");
$item.find("div[class*='name']").empty();
var inputx = $soccerfield_f3.find('input[name="field3[' + id + '][x]"]');
var inputy = $soccerfield_f3.find('input[name="field3[' + id + '][y]"]');
var inputid = $soccerfield_f3.find('input[name="field3[' + id + '][id]"]');
$(inputx).remove();
$(inputy).remove();
if (inputid != null)
$(inputid).remove();
$item.css({left: 0, top: 0, position: "inherit"});
$item.appendTo($drag_players_f3);
$item.draggable("option", "helper", "clone");
return false;
}
function setOffsetF3(player, field) {
var id = $(player).attr("data-id");
var $pdiv = $(field).find('div[data-id="' + id + '"]');
var inputx = $(field).find('input[name="field3[' + id + '][x]"]');
var inputy = $(field).find('input[name="field3[' + id + '][y]"]');
$(inputx).val($(player).position().left);
$(inputy).val($(player).position().top);
}
var $drag_players_f4 = $("#drag-players-field4");
var $soccerfield_f4 = $("#soccerfield-field4");
$(".drag-player-scouting", $drag_players_f4).draggable({
containment: "document", cursor: "move", helper: "clone", stop: function (event, ui) {
setOffsetF4(this, $soccerfield_f4);
}
});
$(".drag-player-scouting", $soccerfield_f4).draggable({
containment: "document", cursor: "move", stop: function (event, ui) {
setOffsetF4(this, $soccerfield_f4);
}
});
$soccerfield_f4.droppable({
accept: "#drag-players-field4 > .drag-player-scouting", drop: function (event, ui) {
placeOnFieldF4(ui.draggable, ui.offset, ui.position, event);
}
});
$drag_players_f4.droppable({
accept: "#soccerfield-field4 > .drag-player-scouting", drop: function (event, ui) {
placeOnBankF4(ui.draggable);
}, hoverClass: "hover"
});
function placeOnFieldF4($item, $offset, $position, e) {
var id = $item.attr("data-id");
var name = ' ';
$item.find("div[class*='name']").empty().append(name);
var valx = parseInt(e.pageX - $soccerfield_f4.offset().left - 5);
var valy = parseInt(e.pageY - $soccerfield_f4.offset().top - 14);
$item.css({top: valy, left: valx, position: "absolute"});
var inputx = ' ';
var inputy = ' ';
$soccerfield_f4.append(inputx);
$soccerfield_f4.append(inputy);
$item.appendTo($soccerfield_f4);
$item.draggable("option", "helper", "original");
return false;
}
function placeOnBankF4($item) {
var id = $item.attr("data-id");
$item.find("div[class*='name']").empty();
var inputx = $soccerfield_f4.find('input[name="field4[' + id + '][x]"]');
var inputy = $soccerfield_f4.find('input[name="field4[' + id + '][y]"]');
var inputid = $soccerfield_f4.find('input[name="field4[' + id + '][id]"]');
$(inputx).remove();
$(inputy).remove();
if (inputid != null)
$(inputid).remove();
$item.css({left: 0, top: 0, position: "inherit"});
$item.appendTo($drag_players_f4);
$item.draggable("option", "helper", "clone");
return false;
}
function setOffsetF4(player, field) {
var id = $(player).attr("data-id");
var $pdiv = $(field).find('div[data-id="' + id + '"]');
var inputx = $(field).find('input[name="field4[' + id + '][x]"]');
var inputy = $(field).find('input[name="field4[' + id + '][y]"]');
$(inputx).val($(player).position().left);
$(inputy).val($(player).position().top);
}
var $drag_players_f5 = $("#drag-players-field5");
var $soccerfield_f5 = $("#soccerfield-field5");
$(".drag-player-scouting", $drag_players_f5).draggable({
containment: "document", cursor: "move", helper: "clone", stop: function (event, ui) {
setOffsetF5(this, $soccerfield_f5);
}
});
$(".drag-player-scouting", $soccerfield_f5).draggable({
containment: "document", cursor: "move", stop: function (event, ui) {
setOffsetF5(this, $soccerfield_f5);
}
});
$soccerfield_f5.droppable({
accept: "#drag-players-field5 > .drag-player-scouting", drop: function (event, ui) {
placeOnFieldF5(ui.draggable, ui.offset, ui.position, event);
}
});
$drag_players_f5.droppable({
accept: "#soccerfield-field5 > .drag-player-scouting", drop: function (event, ui) {
placeOnBankF5(ui.draggable);
}, hoverClass: "hover"
});
function placeOnFieldF5($item, $offset, $position, e) {
var id = $item.attr("data-id");
var name = ' ';
$item.find("div[class*='name']").empty().append(name);
var valx = parseInt(e.pageX - $soccerfield_f5.offset().left - 5);
var valy = parseInt(e.pageY - $soccerfield_f5.offset().top - 14);
$item.css({top: valy, left: valx, position: "absolute"});
var inputx = ' ';
var inputy = ' ';
$soccerfield_f5.append(inputx);
$soccerfield_f5.append(inputy);
$item.appendTo($soccerfield_f5);
$item.draggable("option", "helper", "original");
return false;
}
function placeOnBankF5($item) {
var id = $item.attr("data-id");
$item.find("div[class*='name']").empty();
var inputx = $soccerfield_f5.find('input[name="field5[' + id + '][x]"]');
var inputy = $soccerfield_f5.find('input[name="field5[' + id + '][y]"]');
var inputid = $soccerfield_f5.find('input[name="field5[' + id + '][id]"]');
$(inputx).remove();
$(inputy).remove();
if (inputid != null)
$(inputid).remove();
$item.css({left: 0, top: 0, position: "inherit"});
$item.appendTo($drag_players_f5);
$item.draggable("option", "helper", "clone");
return false;
}
function setOffsetF5(player, field) {
var id = $(player).attr("data-id");
var $pdiv = $(field).find('div[data-id="' + id + '"]');
var inputx = $(field).find('input[name="field5[' + id + '][x]"]');
var inputy = $(field).find('input[name="field5[' + id + '][y]"]');
$(inputx).val($(player).position().left);
$(inputy).val($(player).position().top);
}
var $drag_players_f6 = $("#drag-players-field6");
var $soccerfield_f6 = $("#soccerfield-field6");
$(".drag-player-scouting", $drag_players_f6).draggable({
containment: "document", cursor: "move", helper: "clone", stop: function (event, ui) {
setOffsetF6(this, $soccerfield_f6);
}
});
$(".drag-player-scouting", $soccerfield_f6).draggable({
containment: "document", cursor: "move", stop: function (event, ui) {
setOffsetF6(this, $soccerfield_f6);
}
});
$soccerfield_f6.droppable({
accept: "#drag-players-field6 > .drag-player-scouting", drop: function (event, ui) {
placeOnFieldF6(ui.draggable, ui.offset, ui.position, event);
}
});
$drag_players_f6.droppable({
accept: "#soccerfield-field6 > .drag-player-scouting", drop: function (event, ui) {
placeOnBankF6(ui.draggable);
}, hoverClass: "hover"
});
function placeOnFieldF6($item, $offset, $position, e) {
var id = $item.attr("data-id");
$item.find("div[class*='name']").empty();
var name = ' ';
$item.find("div[class*='name']").empty().append(name);
var valx = parseInt(e.pageX - $soccerfield_f6.offset().left - 5);
var valy = parseInt(e.pageY - $soccerfield_f6.offset().top - 14);
$item.css({top: valy, left: valx, position: "absolute"});
var inputx = ' ';
var inputy = ' ';
$soccerfield_f6.append(inputx);
$soccerfield_f6.append(inputy);
$item.appendTo($soccerfield_f6);
$item.draggable("option", "helper", "original");
return false;
}
function placeOnBankF6($item) {
var id = $item.attr("data-id");
var inputx = $soccerfield_f6.find('input[name="field6[' + id + '][x]"]');
var inputy = $soccerfield_f6.find('input[name="field6[' + id + '][y]"]');
var inputid = $soccerfield_f6.find('input[name="field6[' + id + '][id]"]');
$(inputx).remove();
$(inputy).remove();
if (inputid != null)
$(inputid).remove();
$item.css({left: 0, top: 0, position: "inherit"});
$item.appendTo($drag_players_f6);
$item.draggable("option", "helper", "clone");
return false;
}
function setOffsetF6(player, field) {
var id = $(player).attr("data-id");
var $pdiv = $(field).find('div[data-id="' + id + '"]');
var inputx = $(field).find('input[name="field6[' + id + '][x]"]');
var inputy = $(field).find('input[name="field6[' + id + '][y]"]');
$(inputx).val($(player).position().left);
$(inputy).val($(player).position().top);
}
var $drag_players_f7 = $("#drag-players-field7");
var $soccerfield_f7 = $("#soccerfield-field7");
$(".drag-player-scouting", $drag_players_f7).draggable({
containment: "document", cursor: "move", helper: "clone", stop: function (event, ui) {
setOffsetF7(this, $soccerfield_f7);
}
});
$(".drag-player-scouting", $soccerfield_f7).draggable({
containment: "document", cursor: "move", stop: function (event, ui) {
setOffsetF7(this, $soccerfield_f7);
}
});
$soccerfield_f7.droppable({
accept: "#drag-players-field7 > .drag-player-scouting", drop: function (event, ui) {
placeOnFieldF7(ui.draggable, ui.offset, ui.position, event);
}
});
$drag_players_f7.droppable({
accept: "#soccerfield-field7 > .drag-player-scouting", drop: function (event, ui) {
placeOnBankF7(ui.draggable);
}, hoverClass: "hover"
});
function placeOnFieldF7($item, $offset, $position, e) {
var id = $item.attr("data-id");
$item.find("div[class*='name']").empty();
var name = ' ';
$item.find("div[class*='name']").empty().append(name);
var valx = parseInt(e.pageX - $soccerfield_f7.offset().left - 5);
var valy = parseInt(e.pageY - $soccerfield_f7.offset().top - 14);
$item.css({top: valy, left: valx, position: "absolute"});
var inputx = ' ';
var inputy = ' ';
$soccerfield_f7.append(inputx);
$soccerfield_f7.append(inputy);
$item.appendTo($soccerfield_f7);
$item.draggable("option", "helper", "original");
return false;
}
function placeOnBankF7($item) {
var id = $item.attr("data-id");
var inputx = $soccerfield_f7.find('input[name="field7[' + id + '][x]"]');
var inputy = $soccerfield_f7.find('input[name="field7[' + id + '][y]"]');
var inputid = $soccerfield_f7.find('input[name="field7[' + id + '][id]"]');
$(inputx).remove();
$(inputy).remove();
if (inputid != null)
$(inputid).remove();
$item.css({left: 0, top: 0, position: "inherit"});
$item.appendTo($drag_players_f7);
$item.draggable("option", "helper", "clone");
return false;
}
function setOffsetF7(player, field) {
var id = $(player).attr("data-id");
var $pdiv = $(field).find('div[data-id="' + id + '"]');
var inputx = $(field).find('input[name="field7[' + id + '][x]"]');
var inputy = $(field).find('input[name="field7[' + id + '][y]"]');
$(inputx).val($(player).position().left);
$(inputy).val($(player).position().top);
}
var $drag_players_f8 = $("#drag-players-field8");
var $soccerfield_f8 = $("#soccerfield-field8");
$(".drag-player-scouting", $drag_players_f8).draggable({
containment: "document", cursor: "move", helper: "clone", stop: function (event, ui) {
setOffsetF8(this, $soccerfield_f8);
}
});
$(".drag-player-scouting", $soccerfield_f8).draggable({
containment: "document", cursor: "move", stop: function (event, ui) {
setOffsetF8(this, $soccerfield_f8);
}
});
$soccerfield_f8.droppable({
accept: "#drag-players-field8 > .drag-player-scouting", drop: function (event, ui) {
placeOnFieldF8(ui.draggable, ui.offset, ui.position, event);
}
});
$drag_players_f8.droppable({
accept: "#soccerfield-field8 > .drag-player-scouting", drop: function (event, ui) {
placeOnBankF8(ui.draggable);
}, hoverClass: "hover"
});
function adjustHeight(el) {
el.style.height = (el.scrollHeight > el.clientHeight) ? (el.scrollHeight) + "px" : "60px";
}
function placeOnFieldF8($item, $offset, $position, e) {
var id = $item.attr("data-id");
$item.find("div[class*='name']").empty();
var name = ' ';
$item.find("div[class*='name']").empty().append(name);
var valx = parseInt(e.pageX - $soccerfield_f8.offset().left - 5);
var valy = parseInt(e.pageY - $soccerfield_f8.offset().top - 14);
$item.css({top: valy, left: valx, position: "absolute"});
var inputx = ' ';
var inputy = ' ';
$soccerfield_f8.append(inputx);
$soccerfield_f8.append(inputy);
$item.appendTo($soccerfield_f8);
$item.draggable("option", "helper", "original");
return false;
}
function placeOnBankF8($item) {
var id = $item.attr("data-id");
var inputx = $soccerfield_f8.find('input[name="field8[' + id + '][x]"]');
var inputy = $soccerfield_f8.find('input[name="field8[' + id + '][y]"]');
var inputid = $soccerfield_f8.find('input[name="field8[' + id + '][id]"]');
$(inputx).remove();
$(inputy).remove();
if (inputid != null) on
$(inputid).remove();
$item.css({left: 0, top: 0, position: "inherit"});
$item.appendTo($drag_players_f8);
$item.draggable("option", "helper", "clone");
re
return false;
}
function setOffsetF8(player, field) {
var id = $(player).attr("data-id");
var $pdiv = $(field).find('div[data-id="' + id + '"]');
var inputx = $(field).find('input[name="field8[' + id + '][x]"]');
var inputy = $(field).find('input[name="field8[' + id + '][y]"]');
$(inputx).val($(player).position().left);
$(inputy).val($(player).position().top);
}
$("#scouting-stats").tablesorter();
});
function adjustHeight(o, event) {
o.style.height = "60px";
setTimeout(function () {
o.style.height = (o.scrollHeight) + "px";
}, 5);
}